
(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 19 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.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.54)
(fabs (sin th))
(if (<= (sin th) -0.005)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(if (<= (sin th) 2e-9)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin th) 0.735)
(/ (sin ky) (fabs (/ (sin ky) (sin th))))
(* (sin ky) (fabs (/ (sin th) (sin kx)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.54) {
tmp = fabs(sin(th));
} else if (sin(th) <= -0.005) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else if (sin(th) <= 2e-9) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(th) <= 0.735) {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.54) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else if (Math.sin(th) <= 2e-9) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(th) <= 0.735) {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.54: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= -0.005: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) elif math.sin(th) <= 2e-9: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(th) <= 0.735: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); elseif (sin(th) <= 2e-9) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(th) <= 0.735) tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = sin(th) * abs((sin(ky) / sin(kx))); elseif (sin(th) <= 2e-9) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(th) <= 0.735) tmp = sin(ky) / abs((sin(ky) / sin(th))); else tmp = sin(ky) * abs((sin(th) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.54], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-9], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.735], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.54:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq -0.005:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin th \leq 0.735:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.54000000000000004Initial program 92.9%
associate-/r/92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 24.5%
associate-/r/24.5%
*-inverses24.5%
*-un-lft-identity24.5%
add-sqr-sqrt0.0%
sqrt-unprod31.3%
pow231.3%
Applied egg-rr31.3%
unpow231.3%
rem-sqrt-square31.3%
Simplified31.3%
if -0.54000000000000004 < (sin.f64 th) < -0.0050000000000000001Initial program 96.6%
+-commutative96.6%
unpow296.6%
unpow296.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 26.4%
add-sqr-sqrt16.3%
sqrt-unprod21.5%
pow221.5%
Applied egg-rr21.5%
unpow221.5%
rem-sqrt-square32.4%
Simplified32.4%
if -0.0050000000000000001 < (sin.f64 th) < 2.00000000000000012e-9Initial program 89.2%
associate-*l/85.3%
+-commutative85.3%
unpow285.3%
unpow285.3%
hypot-def89.8%
Simplified89.8%
Taylor expanded in th around 0 89.0%
expm1-log1p-u89.0%
expm1-udef17.0%
div-inv17.0%
*-commutative17.0%
associate-*l*17.0%
div-inv17.0%
Applied egg-rr17.0%
expm1-def99.0%
expm1-log1p99.0%
*-commutative99.0%
associate-*l/89.0%
associate-*r/98.9%
Simplified98.9%
if 2.00000000000000012e-9 < (sin.f64 th) < 0.734999999999999987Initial program 93.6%
associate-/r/93.5%
+-commutative93.5%
unpow293.5%
unpow293.5%
hypot-def99.3%
Simplified99.3%
Taylor expanded in kx around 0 23.4%
add-sqr-sqrt22.6%
sqrt-unprod51.9%
pow251.9%
Applied egg-rr51.9%
unpow251.9%
rem-sqrt-square55.1%
Simplified55.1%
if 0.734999999999999987 < (sin.f64 th) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 34.1%
Taylor expanded in ky around inf 34.2%
associate-/l*34.0%
associate-/r/34.2%
Simplified34.2%
add-sqr-sqrt33.2%
sqrt-unprod47.5%
pow247.5%
Applied egg-rr47.5%
unpow247.5%
rem-sqrt-square47.6%
Simplified47.6%
Final simplification67.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.54)
(fabs (sin th))
(if (<= (sin th) -0.005)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(if (<= (sin th) 2e-9)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= (sin th) 0.735)
(/ (sin ky) (fabs (/ (sin ky) (sin th))))
(* (sin ky) (fabs (/ (sin th) (sin kx)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.54) {
tmp = fabs(sin(th));
} else if (sin(th) <= -0.005) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else if (sin(th) <= 2e-9) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (sin(th) <= 0.735) {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.54) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else if (Math.sin(th) <= 2e-9) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (Math.sin(th) <= 0.735) {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.54: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= -0.005: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) elif math.sin(th) <= 2e-9: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif math.sin(th) <= 0.735: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); elseif (sin(th) <= 2e-9) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (sin(th) <= 0.735) tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = sin(th) * abs((sin(ky) / sin(kx))); elseif (sin(th) <= 2e-9) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; elseif (sin(th) <= 0.735) tmp = sin(ky) / abs((sin(ky) / sin(th))); else tmp = sin(ky) * abs((sin(th) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.54], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-9], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.735], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.54:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq -0.005:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin th \leq 0.735:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.54000000000000004Initial program 92.9%
associate-/r/92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 24.5%
associate-/r/24.5%
*-inverses24.5%
*-un-lft-identity24.5%
add-sqr-sqrt0.0%
sqrt-unprod31.3%
pow231.3%
Applied egg-rr31.3%
unpow231.3%
rem-sqrt-square31.3%
Simplified31.3%
if -0.54000000000000004 < (sin.f64 th) < -0.0050000000000000001Initial program 96.6%
+-commutative96.6%
unpow296.6%
unpow296.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 26.4%
add-sqr-sqrt16.3%
sqrt-unprod21.5%
pow221.5%
Applied egg-rr21.5%
unpow221.5%
rem-sqrt-square32.4%
Simplified32.4%
if -0.0050000000000000001 < (sin.f64 th) < 2.00000000000000012e-9Initial program 89.2%
associate-*l/85.3%
+-commutative85.3%
unpow285.3%
unpow285.3%
hypot-def89.8%
Simplified89.8%
Taylor expanded in th around 0 89.0%
associate-/l*98.9%
associate-/r/99.0%
Applied egg-rr99.0%
if 2.00000000000000012e-9 < (sin.f64 th) < 0.734999999999999987Initial program 93.6%
associate-/r/93.5%
+-commutative93.5%
unpow293.5%
unpow293.5%
hypot-def99.3%
Simplified99.3%
Taylor expanded in kx around 0 23.4%
add-sqr-sqrt22.6%
sqrt-unprod51.9%
pow251.9%
Applied egg-rr51.9%
unpow251.9%
rem-sqrt-square55.1%
Simplified55.1%
if 0.734999999999999987 < (sin.f64 th) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 34.1%
Taylor expanded in ky around inf 34.2%
associate-/l*34.0%
associate-/r/34.2%
Simplified34.2%
add-sqr-sqrt33.2%
sqrt-unprod47.5%
pow247.5%
Applied egg-rr47.5%
unpow247.5%
rem-sqrt-square47.6%
Simplified47.6%
Final simplification67.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sin kx))))
(if (<= (sin ky) -1e-112)
(fabs (sin th))
(if (<= (sin ky) -5e-301)
(fabs (* (sin th) t_1))
(if (<= (sin ky) 5e-35) (* (sin th) (fabs t_1)) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sin(kx);
double tmp;
if (sin(ky) <= -1e-112) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-301) {
tmp = fabs((sin(th) * t_1));
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * fabs(t_1);
} 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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sin(kx)
if (sin(ky) <= (-1d-112)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-5d-301)) then
tmp = abs((sin(th) * t_1))
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * abs(t_1)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sin(kx);
double tmp;
if (Math.sin(ky) <= -1e-112) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-301) {
tmp = Math.abs((Math.sin(th) * t_1));
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * Math.abs(t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sin(kx) tmp = 0 if math.sin(ky) <= -1e-112: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-301: tmp = math.fabs((math.sin(th) * t_1)) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * math.fabs(t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sin(kx)) tmp = 0.0 if (sin(ky) <= -1e-112) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = abs(Float64(sin(th) * t_1)); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * abs(t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sin(kx); tmp = 0.0; if (sin(ky) <= -1e-112) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = abs((sin(th) * t_1)); elseif (sin(ky) <= 5e-35) tmp = sin(th) * abs(t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-112], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-301], N[Abs[N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-112}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-301}:\\
\;\;\;\;\left|\sin th \cdot t_1\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \left|t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999995e-113Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-/r/2.7%
*-inverses2.7%
*-un-lft-identity2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr31.2%
unpow231.2%
rem-sqrt-square40.4%
Simplified40.4%
if -9.9999999999999995e-113 < (sin.f64 ky) < -5.00000000000000013e-301Initial program 81.7%
+-commutative81.7%
unpow281.7%
unpow281.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.1%
add-sqr-sqrt9.4%
sqrt-unprod18.0%
pow218.0%
Applied egg-rr18.0%
unpow218.0%
rem-sqrt-square17.5%
Simplified17.5%
add-sqr-sqrt14.7%
sqrt-unprod31.3%
pow231.3%
*-commutative31.3%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt31.3%
clear-num31.3%
un-div-inv31.3%
Applied egg-rr31.3%
unpow231.3%
rem-sqrt-square64.7%
associate-/l*52.9%
associate-*r/64.8%
Simplified64.8%
if -5.00000000000000013e-301 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 76.7%
+-commutative76.7%
unpow276.7%
unpow276.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 51.1%
add-sqr-sqrt39.9%
sqrt-unprod52.2%
pow252.2%
Applied egg-rr52.2%
unpow252.2%
rem-sqrt-square77.7%
Simplified77.7%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification56.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.02)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 0.0013)
(/ (/ (sin th) t_1) (+ (* ky 0.16666666666666666) (/ 1.0 ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 0.0013) {
tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 0.0013) {
tmp = (Math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 0.0013: tmp = (math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 0.0013) tmp = Float64(Float64(sin(th) / t_1) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 0.0013) tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0013], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 0.0013:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 53.4%
associate-/l*53.4%
associate-/r/53.6%
Applied egg-rr53.6%
if -0.0200000000000000004 < (sin.f64 ky) < 0.0012999999999999999Initial program 84.4%
associate-/r/84.4%
+-commutative84.4%
unpow284.4%
unpow284.4%
hypot-def99.6%
Simplified99.6%
*-un-lft-identity99.6%
div-inv99.4%
times-frac89.7%
Applied egg-rr89.7%
frac-times99.4%
*-un-lft-identity99.4%
div-inv99.3%
un-div-inv99.4%
clear-num99.6%
*-commutative99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.4%
if 0.0012999999999999999 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification76.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.02)
(* (/ 1.0 t_1) (/ (sin ky) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 0.0013)
(/ (/ (sin th) t_1) (+ (* ky 0.16666666666666666) (/ 1.0 ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = (1.0 / t_1) * (sin(ky) / ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 0.0013) {
tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = (1.0 / t_1) * (Math.sin(ky) / ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 0.0013) {
tmp = (Math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = (1.0 / t_1) * (math.sin(ky) / ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 0.0013: tmp = (math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(1.0 / t_1) * Float64(sin(ky) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 0.0013) tmp = Float64(Float64(sin(th) / t_1) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = (1.0 / t_1) * (sin(ky) / ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 0.0013) tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(1.0 / t$95$1), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0013], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{1}{t_1} \cdot \frac{\sin ky}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq 0.0013:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
*-un-lft-identity99.5%
div-inv99.5%
times-frac99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 53.6%
*-commutative53.6%
Simplified53.6%
if -0.0200000000000000004 < (sin.f64 ky) < 0.0012999999999999999Initial program 84.4%
associate-/r/84.4%
+-commutative84.4%
unpow284.4%
unpow284.4%
hypot-def99.6%
Simplified99.6%
*-un-lft-identity99.6%
div-inv99.4%
times-frac89.7%
Applied egg-rr89.7%
frac-times99.4%
*-un-lft-identity99.4%
div-inv99.3%
un-div-inv99.4%
clear-num99.6%
*-commutative99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.4%
if 0.0012999999999999999 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification76.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -2e-7)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 0.0013) (/ (/ (sin th) t_1) (/ 1.0 ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -2e-7) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 0.0013) {
tmp = (sin(th) / t_1) / (1.0 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -2e-7) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 0.0013) {
tmp = (Math.sin(th) / t_1) / (1.0 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -2e-7: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 0.0013: tmp = (math.sin(th) / t_1) / (1.0 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -2e-7) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 0.0013) tmp = Float64(Float64(sin(th) / t_1) / Float64(1.0 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -2e-7) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 0.0013) tmp = (sin(th) / t_1) / (1.0 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-7], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0013], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(1.0 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 0.0013:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{\frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.9999999999999999e-7Initial program 99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 54.2%
associate-/l*54.2%
associate-/r/54.3%
Applied egg-rr54.3%
if -1.9999999999999999e-7 < (sin.f64 ky) < 0.0012999999999999999Initial program 84.3%
associate-/r/84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
hypot-def99.6%
Simplified99.6%
*-un-lft-identity99.6%
div-inv99.4%
times-frac89.6%
Applied egg-rr89.6%
frac-times99.4%
*-un-lft-identity99.4%
div-inv99.3%
un-div-inv99.3%
clear-num99.6%
*-commutative99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.1%
if 0.0012999999999999999 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (sin kx))))
(if (<= (sin ky) -2e-104)
(fabs (sin th))
(if (<= (sin ky) -5e-301)
(* (sin th) t_1)
(if (<= (sin ky) 5e-35) (* (sin th) (fabs t_1)) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = ky / sin(kx);
double tmp;
if (sin(ky) <= -2e-104) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-301) {
tmp = sin(th) * t_1;
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * fabs(t_1);
} 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) :: t_1
real(8) :: tmp
t_1 = ky / sin(kx)
if (sin(ky) <= (-2d-104)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-5d-301)) then
tmp = sin(th) * t_1
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * abs(t_1)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / Math.sin(kx);
double tmp;
if (Math.sin(ky) <= -2e-104) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-301) {
tmp = Math.sin(th) * t_1;
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * Math.abs(t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / math.sin(kx) tmp = 0 if math.sin(ky) <= -2e-104: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-301: tmp = math.sin(th) * t_1 elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * math.fabs(t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky / sin(kx)) tmp = 0.0 if (sin(ky) <= -2e-104) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = Float64(sin(th) * t_1); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * abs(t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / sin(kx); tmp = 0.0; if (sin(ky) <= -2e-104) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = sin(th) * t_1; elseif (sin(ky) <= 5e-35) tmp = sin(th) * abs(t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-104], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-301], N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-104}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-301}:\\
\;\;\;\;\sin th \cdot t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \left|t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999985e-104Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-/r/2.7%
*-inverses2.7%
*-un-lft-identity2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.6%
pow231.6%
Applied egg-rr31.6%
unpow231.6%
rem-sqrt-square40.9%
Simplified40.9%
if -1.99999999999999985e-104 < (sin.f64 ky) < -5.00000000000000013e-301Initial program 82.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 56.9%
if -5.00000000000000013e-301 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 76.7%
+-commutative76.7%
unpow276.7%
unpow276.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 51.1%
add-sqr-sqrt39.9%
sqrt-unprod52.2%
pow252.2%
Applied egg-rr52.2%
unpow252.2%
rem-sqrt-square77.7%
Simplified77.7%
Taylor expanded in ky around 0 77.7%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification55.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-112)
(fabs (sin th))
(if (<= (sin ky) -5e-301)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin ky) 5e-35) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-112) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-301) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-112)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-5d-301)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-112) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-301) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-112: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-301: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-112) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-112) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-301) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(ky) <= 5e-35) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-112], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-301], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-112}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-301}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999995e-113Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-/r/2.7%
*-inverses2.7%
*-un-lft-identity2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr31.2%
unpow231.2%
rem-sqrt-square40.4%
Simplified40.4%
if -9.9999999999999995e-113 < (sin.f64 ky) < -5.00000000000000013e-301Initial program 81.7%
+-commutative81.7%
unpow281.7%
unpow281.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.1%
add-sqr-sqrt9.4%
sqrt-unprod18.0%
pow218.0%
Applied egg-rr18.0%
unpow218.0%
rem-sqrt-square17.5%
Simplified17.5%
add-sqr-sqrt14.7%
sqrt-unprod31.3%
pow231.3%
*-commutative31.3%
add-sqr-sqrt11.3%
fabs-sqr11.3%
add-sqr-sqrt31.3%
clear-num31.3%
un-div-inv31.3%
Applied egg-rr31.3%
unpow231.3%
rem-sqrt-square64.7%
associate-/l*52.9%
associate-*r/64.8%
Simplified64.8%
if -5.00000000000000013e-301 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 76.7%
+-commutative76.7%
unpow276.7%
unpow276.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 51.1%
add-sqr-sqrt39.9%
sqrt-unprod52.2%
pow252.2%
Applied egg-rr52.2%
unpow252.2%
rem-sqrt-square77.7%
Simplified77.7%
Taylor expanded in ky around 0 77.7%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.9%
Final simplification56.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= (sin th) -0.005) (not (<= (sin th) 4e-9)))
(/ (* ky (sin th)) t_1)
(* (/ (sin ky) t_1) th))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((sin(th) <= -0.005) || !(sin(th) <= 4e-9)) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = (sin(ky) / t_1) * th;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if ((Math.sin(th) <= -0.005) || !(Math.sin(th) <= 4e-9)) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = (Math.sin(ky) / t_1) * th;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (math.sin(th) <= -0.005) or not (math.sin(th) <= 4e-9): tmp = (ky * math.sin(th)) / t_1 else: tmp = (math.sin(ky) / t_1) * th return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((sin(th) <= -0.005) || !(sin(th) <= 4e-9)) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = Float64(Float64(sin(ky) / t_1) * th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((sin(th) <= -0.005) || ~((sin(th) <= 4e-9))) tmp = (ky * sin(th)) / t_1; else tmp = (sin(ky) / t_1) * th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[Or[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[Not[LessEqual[N[Sin[th], $MachinePrecision], 4e-9]], $MachinePrecision]], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin th \leq -0.005 \lor \neg \left(\sin th \leq 4 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0050000000000000001 or 4.00000000000000025e-9 < (sin.f64 th) Initial program 95.2%
associate-*l/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 52.0%
if -0.0050000000000000001 < (sin.f64 th) < 4.00000000000000025e-9Initial program 89.3%
associate-*l/85.4%
+-commutative85.4%
unpow285.4%
unpow285.4%
hypot-def89.9%
Simplified89.9%
Taylor expanded in th around 0 89.1%
associate-/l*98.9%
associate-/r/99.0%
Applied egg-rr99.0%
Final simplification74.2%
(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.4%
associate-*l/90.5%
associate-*r/92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-104) (fabs (sin th)) (if (<= (sin ky) 4e-190) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-104) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-190) {
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) <= (-2d-104)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-190) 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) <= -2e-104) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-190) {
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) <= -2e-104: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-190: 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) <= -2e-104) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-190) 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) <= -2e-104) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-190) 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], -2e-104], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-190], 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 -2 \cdot 10^{-104}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-190}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999985e-104Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-/r/2.7%
*-inverses2.7%
*-un-lft-identity2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.6%
pow231.6%
Applied egg-rr31.6%
unpow231.6%
rem-sqrt-square40.9%
Simplified40.9%
if -1.99999999999999985e-104 < (sin.f64 ky) < 4.0000000000000001e-190Initial program 78.1%
+-commutative78.1%
unpow278.1%
unpow278.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 60.0%
if 4.0000000000000001e-190 < (sin.f64 ky) Initial program 95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 53.4%
Final simplification50.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.3e-109) (fabs (sin th)) (if (<= ky 4.6e-189) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.3e-109) {
tmp = fabs(sin(th));
} else if (ky <= 4.6e-189) {
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 <= (-3.3d-109)) then
tmp = abs(sin(th))
else if (ky <= 4.6d-189) 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 <= -3.3e-109) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 4.6e-189) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.3e-109: tmp = math.fabs(math.sin(th)) elif ky <= 4.6e-189: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.3e-109) tmp = abs(sin(th)); elseif (ky <= 4.6e-189) 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 <= -3.3e-109) tmp = abs(sin(th)); elseif (ky <= 4.6e-189) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.3e-109], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 4.6e-189], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.3 \cdot 10^{-109}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-189}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -3.2999999999999999e-109Initial program 99.6%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 23.4%
associate-/r/23.5%
*-inverses23.5%
*-un-lft-identity23.5%
add-sqr-sqrt12.2%
sqrt-unprod26.9%
pow226.9%
Applied egg-rr26.9%
unpow226.9%
rem-sqrt-square36.0%
Simplified36.0%
if -3.2999999999999999e-109 < ky < 4.5999999999999996e-189Initial program 78.1%
associate-*l/72.8%
+-commutative72.8%
unpow272.8%
unpow272.8%
hypot-def87.6%
Simplified87.6%
Taylor expanded in th around 0 38.3%
Taylor expanded in ky around 0 31.6%
associate-/l*36.7%
Simplified36.7%
associate-/r/36.7%
Applied egg-rr36.7%
if 4.5999999999999996e-189 < ky Initial program 95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 35.9%
Final simplification36.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.5e-21) (sin th) (if (<= ky 5e-190) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.5e-21) {
tmp = sin(th);
} else if (ky <= 5e-190) {
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 <= (-3.5d-21)) then
tmp = sin(th)
else if (ky <= 5d-190) 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 <= -3.5e-21) {
tmp = Math.sin(th);
} else if (ky <= 5e-190) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.5e-21: tmp = math.sin(th) elif ky <= 5e-190: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.5e-21) tmp = sin(th); elseif (ky <= 5e-190) 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 <= -3.5e-21) tmp = sin(th); elseif (ky <= 5e-190) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.5e-21], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 5e-190], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.5 \cdot 10^{-21}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5 \cdot 10^{-190}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -3.5000000000000003e-21 or 5.00000000000000034e-190 < ky Initial program 97.3%
+-commutative97.3%
unpow297.3%
unpow297.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.2%
if -3.5000000000000003e-21 < ky < 5.00000000000000034e-190Initial program 83.6%
associate-*l/78.6%
+-commutative78.6%
unpow278.6%
unpow278.6%
hypot-def89.7%
Simplified89.7%
Taylor expanded in th around 0 37.6%
Taylor expanded in ky around 0 25.5%
associate-/l*29.2%
Simplified29.2%
associate-/r/29.2%
Applied egg-rr29.2%
Final simplification31.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1600000000.0) (sin th) (if (<= ky 4.5e-189) (/ ky (/ kx th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1600000000.0) {
tmp = sin(th);
} else if (ky <= 4.5e-189) {
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 <= (-1600000000.0d0)) then
tmp = sin(th)
else if (ky <= 4.5d-189) 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 <= -1600000000.0) {
tmp = Math.sin(th);
} else if (ky <= 4.5e-189) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1600000000.0: tmp = math.sin(th) elif ky <= 4.5e-189: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1600000000.0) tmp = sin(th); elseif (ky <= 4.5e-189) 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 <= -1600000000.0) tmp = sin(th); elseif (ky <= 4.5e-189) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1600000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 4.5e-189], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1600000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.6e9 or 4.4999999999999996e-189 < ky Initial program 97.2%
+-commutative97.2%
unpow297.2%
unpow297.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 34.5%
if -1.6e9 < ky < 4.4999999999999996e-189Initial program 84.7%
associate-*l/80.1%
+-commutative80.1%
unpow280.1%
unpow280.1%
hypot-def90.4%
Simplified90.4%
Taylor expanded in th around 0 40.0%
Taylor expanded in ky around 0 24.8%
associate-/l*28.3%
Simplified28.3%
Taylor expanded in kx around 0 23.4%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.5e-21) th (if (<= ky 4.6e-189) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.5e-21) {
tmp = th;
} else if (ky <= 4.6e-189) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-3.5d-21)) then
tmp = th
else if (ky <= 4.6d-189) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.5e-21) {
tmp = th;
} else if (ky <= 4.6e-189) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.5e-21: tmp = th elif ky <= 4.6e-189: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.5e-21) tmp = th; elseif (ky <= 4.6e-189) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -3.5e-21) tmp = th; elseif (ky <= 4.6e-189) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.5e-21], th, If[LessEqual[ky, 4.6e-189], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.5 \cdot 10^{-21}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-189}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -3.5000000000000003e-21 or 4.5999999999999996e-189 < ky Initial program 97.3%
associate-*l/97.1%
+-commutative97.1%
unpow297.1%
unpow297.1%
hypot-def97.9%
Simplified97.9%
Taylor expanded in th around 0 48.9%
Taylor expanded in kx around 0 19.3%
if -3.5000000000000003e-21 < ky < 4.5999999999999996e-189Initial program 83.6%
associate-*l/78.6%
+-commutative78.6%
unpow278.6%
unpow278.6%
hypot-def89.7%
Simplified89.7%
Taylor expanded in th around 0 37.6%
Taylor expanded in ky around 0 25.5%
associate-/l*29.2%
Simplified29.2%
Taylor expanded in kx around 0 25.0%
associate-/r/24.9%
Applied egg-rr24.9%
Final simplification21.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.5e-21) th (if (<= ky 3.7e-189) (* ky (/ th kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.5e-21) {
tmp = th;
} else if (ky <= 3.7e-189) {
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 <= (-3.5d-21)) then
tmp = th
else if (ky <= 3.7d-189) 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 <= -3.5e-21) {
tmp = th;
} else if (ky <= 3.7e-189) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.5e-21: tmp = th elif ky <= 3.7e-189: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.5e-21) tmp = th; elseif (ky <= 3.7e-189) 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 <= -3.5e-21) tmp = th; elseif (ky <= 3.7e-189) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.5e-21], th, If[LessEqual[ky, 3.7e-189], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.5 \cdot 10^{-21}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.7 \cdot 10^{-189}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -3.5000000000000003e-21 or 3.70000000000000019e-189 < ky Initial program 97.3%
associate-*l/97.1%
+-commutative97.1%
unpow297.1%
unpow297.1%
hypot-def97.9%
Simplified97.9%
Taylor expanded in th around 0 48.9%
Taylor expanded in kx around 0 19.3%
if -3.5000000000000003e-21 < ky < 3.70000000000000019e-189Initial program 83.6%
associate-*l/78.6%
+-commutative78.6%
unpow278.6%
unpow278.6%
hypot-def89.7%
Simplified89.7%
Taylor expanded in th around 0 37.6%
Taylor expanded in ky around 0 25.5%
associate-/l*29.2%
Simplified29.2%
Taylor expanded in kx around 0 25.0%
clear-num24.1%
associate-/r/24.9%
clear-num24.9%
Applied egg-rr24.9%
Final simplification21.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -2.7e-21) th (if (<= ky 4.6e-189) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.7e-21) {
tmp = th;
} else if (ky <= 4.6e-189) {
tmp = ky / (kx / th);
} 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 <= (-2.7d-21)) then
tmp = th
else if (ky <= 4.6d-189) then
tmp = ky / (kx / th)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.7e-21) {
tmp = th;
} else if (ky <= 4.6e-189) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2.7e-21: tmp = th elif ky <= 4.6e-189: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2.7e-21) tmp = th; elseif (ky <= 4.6e-189) tmp = Float64(ky / Float64(kx / th)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -2.7e-21) tmp = th; elseif (ky <= 4.6e-189) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2.7e-21], th, If[LessEqual[ky, 4.6e-189], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2.7 \cdot 10^{-21}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-189}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -2.7000000000000001e-21 or 4.5999999999999996e-189 < ky Initial program 97.3%
associate-*l/97.1%
+-commutative97.1%
unpow297.1%
unpow297.1%
hypot-def97.9%
Simplified97.9%
Taylor expanded in th around 0 48.9%
Taylor expanded in kx around 0 19.3%
if -2.7000000000000001e-21 < ky < 4.5999999999999996e-189Initial program 83.6%
associate-*l/78.6%
+-commutative78.6%
unpow278.6%
unpow278.6%
hypot-def89.7%
Simplified89.7%
Taylor expanded in th around 0 37.6%
Taylor expanded in ky around 0 25.5%
associate-/l*29.2%
Simplified29.2%
Taylor expanded in kx around 0 25.0%
Final simplification21.3%
(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.4%
associate-*l/90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-def94.9%
Simplified94.9%
Taylor expanded in th around 0 44.9%
Taylor expanded in kx around 0 13.9%
Final simplification13.9%
herbie shell --seed 2023257
(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)))