
(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 17 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 89.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin th) -0.76)
t_1
(if (<= (sin th) -0.64)
(/ (sin th) (+ 1.0 (/ (* 0.5 (* kx kx)) (pow (sin ky) 2.0))))
(if (<= (sin th) -0.001)
t_1
(if (<= (sin th) 1e-14)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (fabs (* (sin ky) (sin th))) (sin ky))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(th) <= -0.76) {
tmp = t_1;
} else if (sin(th) <= -0.64) {
tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / pow(sin(ky), 2.0)));
} else if (sin(th) <= -0.001) {
tmp = t_1;
} else if (sin(th) <= 1e-14) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (Math.sin(th) <= -0.76) {
tmp = t_1;
} else if (Math.sin(th) <= -0.64) {
tmp = Math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / Math.pow(Math.sin(ky), 2.0)));
} else if (Math.sin(th) <= -0.001) {
tmp = t_1;
} else if (Math.sin(th) <= 1e-14) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(th) <= -0.76: tmp = t_1 elif math.sin(th) <= -0.64: tmp = math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / math.pow(math.sin(ky), 2.0))) elif math.sin(th) <= -0.001: tmp = t_1 elif math.sin(th) <= 1e-14: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(th) <= -0.76) tmp = t_1; elseif (sin(th) <= -0.64) tmp = Float64(sin(th) / Float64(1.0 + Float64(Float64(0.5 * Float64(kx * kx)) / (sin(ky) ^ 2.0)))); elseif (sin(th) <= -0.001) tmp = t_1; elseif (sin(th) <= 1e-14) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(th) <= -0.76) tmp = t_1; elseif (sin(th) <= -0.64) tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (sin(ky) ^ 2.0))); elseif (sin(th) <= -0.001) tmp = t_1; elseif (sin(th) <= 1e-14) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = abs((sin(ky) * sin(th))) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.76], t$95$1, If[LessEqual[N[Sin[th], $MachinePrecision], -0.64], N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(N[(0.5 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.001], t$95$1, If[LessEqual[N[Sin[th], $MachinePrecision], 1e-14], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin th \leq -0.76:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin th \leq -0.64:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\
\mathbf{elif}\;\sin th \leq -0.001:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin th \leq 10^{-14}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.76000000000000001 or -0.640000000000000013 < (sin.f64 th) < -1e-3Initial program 84.0%
associate-*l/84.0%
associate-*r/83.8%
+-commutative83.8%
unpow283.8%
unpow283.8%
hypot-def99.4%
Simplified99.4%
Taylor expanded in kx around 0 14.6%
add-sqr-sqrt0.0%
sqrt-unprod35.5%
pow235.5%
Applied egg-rr35.5%
*-commutative35.5%
associate-/r/35.6%
*-inverses35.6%
/-rgt-identity35.6%
unpow235.6%
rem-sqrt-square35.6%
Simplified35.6%
if -0.76000000000000001 < (sin.f64 th) < -0.640000000000000013Initial program 100.0%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-*r/99.5%
*-commutative99.5%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 84.3%
associate-*r/84.3%
unpow284.3%
Simplified84.3%
if -1e-3 < (sin.f64 th) < 9.99999999999999999e-15Initial program 93.8%
associate-*l/86.5%
+-commutative86.5%
unpow286.5%
unpow286.5%
hypot-def89.8%
Simplified89.8%
Taylor expanded in th around 0 89.8%
expm1-log1p-u89.8%
expm1-udef20.0%
*-un-lft-identity20.0%
times-frac20.0%
/-rgt-identity20.0%
Applied egg-rr20.0%
expm1-def99.8%
expm1-log1p99.8%
Simplified99.8%
if 9.99999999999999999e-15 < (sin.f64 th) Initial program 86.0%
associate-*l/86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.1%
add-sqr-sqrt25.0%
sqrt-unprod45.3%
pow245.3%
*-commutative45.3%
Applied egg-rr45.3%
unpow245.3%
rem-sqrt-square47.5%
*-commutative47.5%
Simplified47.5%
Final simplification72.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin th) -0.76)
t_1
(if (<= (sin th) -0.64)
(/ (sin th) (+ 1.0 (/ (* 0.5 (* kx kx)) (pow (sin ky) 2.0))))
(if (<= (sin th) -0.001)
t_1
(if (<= (sin th) 1e-14)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(/ (fabs (* (sin ky) (sin th))) (sin ky))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(th) <= -0.76) {
tmp = t_1;
} else if (sin(th) <= -0.64) {
tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / pow(sin(ky), 2.0)));
} else if (sin(th) <= -0.001) {
tmp = t_1;
} else if (sin(th) <= 1e-14) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (Math.sin(th) <= -0.76) {
tmp = t_1;
} else if (Math.sin(th) <= -0.64) {
tmp = Math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / Math.pow(Math.sin(ky), 2.0)));
} else if (Math.sin(th) <= -0.001) {
tmp = t_1;
} else if (Math.sin(th) <= 1e-14) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(th) <= -0.76: tmp = t_1 elif math.sin(th) <= -0.64: tmp = math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / math.pow(math.sin(ky), 2.0))) elif math.sin(th) <= -0.001: tmp = t_1 elif math.sin(th) <= 1e-14: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(th) <= -0.76) tmp = t_1; elseif (sin(th) <= -0.64) tmp = Float64(sin(th) / Float64(1.0 + Float64(Float64(0.5 * Float64(kx * kx)) / (sin(ky) ^ 2.0)))); elseif (sin(th) <= -0.001) tmp = t_1; elseif (sin(th) <= 1e-14) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(th) <= -0.76) tmp = t_1; elseif (sin(th) <= -0.64) tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (sin(ky) ^ 2.0))); elseif (sin(th) <= -0.001) tmp = t_1; elseif (sin(th) <= 1e-14) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = abs((sin(ky) * sin(th))) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.76], t$95$1, If[LessEqual[N[Sin[th], $MachinePrecision], -0.64], N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(N[(0.5 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.001], t$95$1, If[LessEqual[N[Sin[th], $MachinePrecision], 1e-14], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin th \leq -0.76:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin th \leq -0.64:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\
\mathbf{elif}\;\sin th \leq -0.001:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin th \leq 10^{-14}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.76000000000000001 or -0.640000000000000013 < (sin.f64 th) < -1e-3Initial program 84.0%
associate-*l/84.0%
associate-*r/83.8%
+-commutative83.8%
unpow283.8%
unpow283.8%
hypot-def99.4%
Simplified99.4%
Taylor expanded in kx around 0 14.6%
add-sqr-sqrt0.0%
sqrt-unprod35.5%
pow235.5%
Applied egg-rr35.5%
*-commutative35.5%
associate-/r/35.6%
*-inverses35.6%
/-rgt-identity35.6%
unpow235.6%
rem-sqrt-square35.6%
Simplified35.6%
if -0.76000000000000001 < (sin.f64 th) < -0.640000000000000013Initial program 100.0%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-*r/99.5%
*-commutative99.5%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 84.3%
associate-*r/84.3%
unpow284.3%
Simplified84.3%
if -1e-3 < (sin.f64 th) < 9.99999999999999999e-15Initial program 93.8%
associate-*l/86.5%
+-commutative86.5%
unpow286.5%
unpow286.5%
hypot-def89.8%
Simplified89.8%
Taylor expanded in th around 0 89.8%
associate-/l*99.7%
associate-/r/99.8%
Applied egg-rr99.8%
if 9.99999999999999999e-15 < (sin.f64 th) Initial program 86.0%
associate-*l/86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.1%
add-sqr-sqrt25.0%
sqrt-unprod45.3%
pow245.3%
*-commutative45.3%
Applied egg-rr45.3%
unpow245.3%
rem-sqrt-square47.5%
*-commutative47.5%
Simplified47.5%
Final simplification72.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.97)
(fabs (sin th))
(if (<= (sin ky) -0.71)
(- th)
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) -5e-181)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 5e-206) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.97) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.71) {
tmp = -th;
} else if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= -5e-181) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 5e-206) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.97) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.71) {
tmp = -th;
} else if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= -5e-181) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.97: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.71: tmp = -th elif math.sin(ky) <= -0.02: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= -5e-181: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 5e-206: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.71) tmp = Float64(-th); elseif (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= -5e-181) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 5e-206) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.71) tmp = -th; elseif (sin(ky) <= -0.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= -5e-181) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 5e-206) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.71], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-181], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.71:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-181}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 1.7%
add-sqr-sqrt0.5%
sqrt-unprod58.7%
pow258.7%
Applied egg-rr58.7%
*-commutative58.7%
associate-/r/58.7%
*-inverses58.7%
/-rgt-identity58.7%
unpow258.7%
rem-sqrt-square58.7%
Simplified58.7%
if -0.96999999999999997 < (sin.f64 ky) < -0.70999999999999996Initial program 99.7%
associate-*l/99.6%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 3.5%
add-sqr-sqrt2.2%
sqrt-unprod18.9%
pow218.9%
Applied egg-rr18.9%
*-commutative18.9%
associate-/r/18.9%
*-inverses18.9%
/-rgt-identity18.9%
Simplified18.9%
Taylor expanded in th around 0 9.0%
unpow29.0%
Simplified9.0%
Taylor expanded in th around -inf 52.1%
neg-mul-152.1%
Simplified52.1%
if -0.70999999999999996 < (sin.f64 ky) < -0.0200000000000000004Initial program 99.9%
associate-*l/99.7%
associate-*r/99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod36.1%
pow236.1%
Applied egg-rr36.1%
unpow236.1%
rem-sqrt-square39.7%
Simplified39.7%
if -0.0200000000000000004 < (sin.f64 ky) < -5.0000000000000001e-181Initial program 97.0%
associate-*l/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def90.9%
Simplified90.9%
Taylor expanded in th around 0 46.4%
Taylor expanded in ky around 0 46.4%
if -5.0000000000000001e-181 < (sin.f64 ky) < 5e-206Initial program 65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 63.2%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification54.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.97)
(fabs (sin th))
(if (<= (sin ky) -0.71)
(- th)
(if (<= (sin ky) -0.02)
(/ (fabs (* (sin ky) (sin th))) (sin ky))
(if (<= (sin ky) -5e-181)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 5e-206) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.97) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.71) {
tmp = -th;
} else if (sin(ky) <= -0.02) {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
} else if (sin(ky) <= -5e-181) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 5e-206) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.97) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.71) {
tmp = -th;
} else if (Math.sin(ky) <= -0.02) {
tmp = Math.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
} else if (Math.sin(ky) <= -5e-181) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.97: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.71: tmp = -th elif math.sin(ky) <= -0.02: tmp = math.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) elif math.sin(ky) <= -5e-181: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 5e-206: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.71) tmp = Float64(-th); elseif (sin(ky) <= -0.02) tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); elseif (sin(ky) <= -5e-181) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 5e-206) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.71) tmp = -th; elseif (sin(ky) <= -0.02) tmp = abs((sin(ky) * sin(th))) / sin(ky); elseif (sin(ky) <= -5e-181) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 5e-206) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.71], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-181], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.71:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-181}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 1.7%
add-sqr-sqrt0.5%
sqrt-unprod58.7%
pow258.7%
Applied egg-rr58.7%
*-commutative58.7%
associate-/r/58.7%
*-inverses58.7%
/-rgt-identity58.7%
unpow258.7%
rem-sqrt-square58.7%
Simplified58.7%
if -0.96999999999999997 < (sin.f64 ky) < -0.70999999999999996Initial program 99.7%
associate-*l/99.6%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 3.5%
add-sqr-sqrt2.2%
sqrt-unprod18.9%
pow218.9%
Applied egg-rr18.9%
*-commutative18.9%
associate-/r/18.9%
*-inverses18.9%
/-rgt-identity18.9%
Simplified18.9%
Taylor expanded in th around 0 9.0%
unpow29.0%
Simplified9.0%
Taylor expanded in th around -inf 52.1%
neg-mul-152.1%
Simplified52.1%
if -0.70999999999999996 < (sin.f64 ky) < -0.0200000000000000004Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod36.2%
pow236.2%
*-commutative36.2%
Applied egg-rr36.2%
unpow236.2%
rem-sqrt-square39.8%
*-commutative39.8%
Simplified39.8%
if -0.0200000000000000004 < (sin.f64 ky) < -5.0000000000000001e-181Initial program 97.0%
associate-*l/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def90.9%
Simplified90.9%
Taylor expanded in th around 0 46.4%
Taylor expanded in ky around 0 46.4%
if -5.0000000000000001e-181 < (sin.f64 ky) < 5e-206Initial program 65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 63.2%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification54.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.97)
(fabs (sin th))
(if (<= (sin ky) -5e-30)
(- th)
(if (<= (sin ky) -2e-189)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 5e-206)
(/ (sin ky) (/ (sin kx) (sin th)))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.97) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-30) {
tmp = -th;
} else if (sin(ky) <= -2e-189) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 5e-206) {
tmp = sin(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 (sin(ky) <= (-0.97d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-5d-30)) then
tmp = -th
else if (sin(ky) <= (-2d-189)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 5d-206) then
tmp = sin(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 (Math.sin(ky) <= -0.97) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-30) {
tmp = -th;
} else if (Math.sin(ky) <= -2e-189) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.97: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-30: tmp = -th elif math.sin(ky) <= -2e-189: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 5e-206: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-30) tmp = Float64(-th); elseif (sin(ky) <= -2e-189) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-206) tmp = Float64(sin(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 (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-30) tmp = -th; elseif (sin(ky) <= -2e-189) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-206) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-30], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-189], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-30}:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-189}:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 1.7%
add-sqr-sqrt0.5%
sqrt-unprod58.7%
pow258.7%
Applied egg-rr58.7%
*-commutative58.7%
associate-/r/58.7%
*-inverses58.7%
/-rgt-identity58.7%
unpow258.7%
rem-sqrt-square58.7%
Simplified58.7%
if -0.96999999999999997 < (sin.f64 ky) < -4.99999999999999972e-30Initial program 99.7%
associate-*l/99.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.8%
sqrt-unprod21.8%
pow221.8%
Applied egg-rr21.8%
*-commutative21.8%
associate-/r/21.8%
*-inverses21.8%
/-rgt-identity21.8%
Simplified21.8%
Taylor expanded in th around 0 11.4%
unpow211.4%
Simplified11.4%
Taylor expanded in th around -inf 39.5%
neg-mul-139.5%
Simplified39.5%
if -4.99999999999999972e-30 < (sin.f64 ky) < -2.00000000000000014e-189Initial program 91.3%
associate-*l/81.9%
associate-*r/91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.5%
sqrt-unprod47.0%
pow247.0%
Applied egg-rr47.0%
*-commutative47.0%
associate-/r/47.1%
*-inverses47.1%
/-rgt-identity47.1%
Simplified47.1%
if -2.00000000000000014e-189 < (sin.f64 ky) < 5e-206Initial program 66.2%
associate-/r/66.2%
+-commutative66.2%
unpow266.2%
unpow266.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 64.2%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification53.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (/ (* ky (sin th)) t_1)))
(if (<= (sin th) -0.02)
t_2
(if (<= (sin th) 2e-22)
(* (/ (sin ky) t_1) th)
(if (<= (sin th) 0.75)
t_2
(/ (fabs (* (sin ky) (sin th))) (sin ky)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = (ky * sin(th)) / t_1;
double tmp;
if (sin(th) <= -0.02) {
tmp = t_2;
} else if (sin(th) <= 2e-22) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(th) <= 0.75) {
tmp = t_2;
} else {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = (ky * Math.sin(th)) / t_1;
double tmp;
if (Math.sin(th) <= -0.02) {
tmp = t_2;
} else if (Math.sin(th) <= 2e-22) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(th) <= 0.75) {
tmp = t_2;
} else {
tmp = Math.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = (ky * math.sin(th)) / t_1 tmp = 0 if math.sin(th) <= -0.02: tmp = t_2 elif math.sin(th) <= 2e-22: tmp = (math.sin(ky) / t_1) * th elif math.sin(th) <= 0.75: tmp = t_2 else: tmp = math.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(Float64(ky * sin(th)) / t_1) tmp = 0.0 if (sin(th) <= -0.02) tmp = t_2; elseif (sin(th) <= 2e-22) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(th) <= 0.75) tmp = t_2; else tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = (ky * sin(th)) / t_1; tmp = 0.0; if (sin(th) <= -0.02) tmp = t_2; elseif (sin(th) <= 2e-22) tmp = (sin(ky) / t_1) * th; elseif (sin(th) <= 0.75) tmp = t_2; else tmp = abs((sin(ky) * sin(th))) / sin(ky); 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]}, Block[{t$95$2 = N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], t$95$2, If[LessEqual[N[Sin[th], $MachinePrecision], 2e-22], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.75], t$95$2, N[(N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \frac{ky \cdot \sin th}{t_1}\\
\mathbf{if}\;\sin th \leq -0.02:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin th \leq 0.75:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004 or 2.0000000000000001e-22 < (sin.f64 th) < 0.75Initial program 81.9%
associate-*l/81.8%
+-commutative81.8%
unpow281.8%
unpow281.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 59.8%
if -0.0200000000000000004 < (sin.f64 th) < 2.0000000000000001e-22Initial program 94.5%
associate-*l/87.3%
+-commutative87.3%
unpow287.3%
unpow287.3%
hypot-def89.8%
Simplified89.8%
Taylor expanded in th around 0 88.4%
associate-/l*98.2%
associate-/r/98.3%
Applied egg-rr98.3%
if 0.75 < (sin.f64 th) Initial program 95.9%
associate-*l/96.2%
+-commutative96.2%
unpow296.2%
unpow296.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 32.2%
add-sqr-sqrt31.2%
sqrt-unprod52.3%
pow252.3%
*-commutative52.3%
Applied egg-rr52.3%
unpow252.3%
rem-sqrt-square55.7%
*-commutative55.7%
Simplified55.7%
Final simplification79.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin ky) -0.97)
t_1
(if (<= (sin ky) -0.04)
(- th)
(if (<= (sin ky) -5e-127)
t_1
(if (<= (sin ky) 5e-206) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(ky) <= -0.97) {
tmp = t_1;
} else if (sin(ky) <= -0.04) {
tmp = -th;
} else if (sin(ky) <= -5e-127) {
tmp = t_1;
} else if (sin(ky) <= 5e-206) {
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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (sin(ky) <= (-0.97d0)) then
tmp = t_1
else if (sin(ky) <= (-0.04d0)) then
tmp = -th
else if (sin(ky) <= (-5d-127)) then
tmp = t_1
else if (sin(ky) <= 5d-206) 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 t_1 = Math.abs(Math.sin(th));
double tmp;
if (Math.sin(ky) <= -0.97) {
tmp = t_1;
} else if (Math.sin(ky) <= -0.04) {
tmp = -th;
} else if (Math.sin(ky) <= -5e-127) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(ky) <= -0.97: tmp = t_1 elif math.sin(ky) <= -0.04: tmp = -th elif math.sin(ky) <= -5e-127: tmp = t_1 elif math.sin(ky) <= 5e-206: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(ky) <= -0.97) tmp = t_1; elseif (sin(ky) <= -0.04) tmp = Float64(-th); elseif (sin(ky) <= -5e-127) tmp = t_1; elseif (sin(ky) <= 5e-206) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(ky) <= -0.97) tmp = t_1; elseif (sin(ky) <= -0.04) tmp = -th; elseif (sin(ky) <= -5e-127) tmp = t_1; elseif (sin(ky) <= 5e-206) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-127], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -0.04:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997 or -0.0400000000000000008 < (sin.f64 ky) < -4.9999999999999997e-127Initial program 99.7%
associate-*l/96.0%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.2%
sqrt-unprod41.3%
pow241.3%
Applied egg-rr41.3%
*-commutative41.3%
associate-/r/41.4%
*-inverses41.4%
/-rgt-identity41.4%
unpow241.4%
rem-sqrt-square43.8%
Simplified43.8%
if -0.96999999999999997 < (sin.f64 ky) < -0.0400000000000000008Initial program 99.8%
associate-*l/99.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.8%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
*-commutative22.3%
associate-/r/22.3%
*-inverses22.3%
/-rgt-identity22.3%
Simplified22.3%
Taylor expanded in th around 0 12.2%
unpow212.2%
Simplified12.2%
Taylor expanded in th around -inf 42.5%
neg-mul-142.5%
Simplified42.5%
if -4.9999999999999997e-127 < (sin.f64 ky) < 5e-206Initial program 68.9%
+-commutative68.9%
unpow268.9%
unpow268.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 60.1%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification52.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.97)
(fabs (sin th))
(if (<= (sin ky) -5e-30)
(- th)
(if (<= (sin ky) -2e-189)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 5e-206) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.97) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-30) {
tmp = -th;
} else if (sin(ky) <= -2e-189) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 5e-206) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.97d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-5d-30)) then
tmp = -th
else if (sin(ky) <= (-2d-189)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 5d-206) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.97) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-30) {
tmp = -th;
} else if (Math.sin(ky) <= -2e-189) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.97: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-30: tmp = -th elif math.sin(ky) <= -2e-189: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 5e-206: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-30) tmp = Float64(-th); elseif (sin(ky) <= -2e-189) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-206) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-30) tmp = -th; elseif (sin(ky) <= -2e-189) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-206) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-30], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-189], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-30}:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-189}:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 1.7%
add-sqr-sqrt0.5%
sqrt-unprod58.7%
pow258.7%
Applied egg-rr58.7%
*-commutative58.7%
associate-/r/58.7%
*-inverses58.7%
/-rgt-identity58.7%
unpow258.7%
rem-sqrt-square58.7%
Simplified58.7%
if -0.96999999999999997 < (sin.f64 ky) < -4.99999999999999972e-30Initial program 99.7%
associate-*l/99.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.8%
sqrt-unprod21.8%
pow221.8%
Applied egg-rr21.8%
*-commutative21.8%
associate-/r/21.8%
*-inverses21.8%
/-rgt-identity21.8%
Simplified21.8%
Taylor expanded in th around 0 11.4%
unpow211.4%
Simplified11.4%
Taylor expanded in th around -inf 39.5%
neg-mul-139.5%
Simplified39.5%
if -4.99999999999999972e-30 < (sin.f64 ky) < -2.00000000000000014e-189Initial program 91.3%
associate-*l/81.9%
associate-*r/91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.5%
sqrt-unprod47.0%
pow247.0%
Applied egg-rr47.0%
*-commutative47.0%
associate-/r/47.1%
*-inverses47.1%
/-rgt-identity47.1%
Simplified47.1%
if -2.00000000000000014e-189 < (sin.f64 ky) < 5e-206Initial program 66.2%
+-commutative66.2%
unpow266.2%
unpow266.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 64.1%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification53.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.97)
(fabs (sin th))
(if (<= (sin ky) -0.04)
(- th)
(if (<= (sin ky) -5e-181)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 5e-206) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.97) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.04) {
tmp = -th;
} else if (sin(ky) <= -5e-181) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 5e-206) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.97) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.04) {
tmp = -th;
} else if (Math.sin(ky) <= -5e-181) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 5e-206) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.97: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.04: tmp = -th elif math.sin(ky) <= -5e-181: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 5e-206: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.04) tmp = Float64(-th); elseif (sin(ky) <= -5e-181) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 5e-206) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.97) tmp = abs(sin(th)); elseif (sin(ky) <= -0.04) tmp = -th; elseif (sin(ky) <= -5e-181) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 5e-206) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.97], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-181], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-206], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.97:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.04:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-181}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.96999999999999997Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 1.7%
add-sqr-sqrt0.5%
sqrt-unprod58.7%
pow258.7%
Applied egg-rr58.7%
*-commutative58.7%
associate-/r/58.7%
*-inverses58.7%
/-rgt-identity58.7%
unpow258.7%
rem-sqrt-square58.7%
Simplified58.7%
if -0.96999999999999997 < (sin.f64 ky) < -0.0400000000000000008Initial program 99.8%
associate-*l/99.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.8%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
*-commutative22.3%
associate-/r/22.3%
*-inverses22.3%
/-rgt-identity22.3%
Simplified22.3%
Taylor expanded in th around 0 12.2%
unpow212.2%
Simplified12.2%
Taylor expanded in th around -inf 42.5%
neg-mul-142.5%
Simplified42.5%
if -0.0400000000000000008 < (sin.f64 ky) < -5.0000000000000001e-181Initial program 97.2%
associate-*l/88.8%
+-commutative88.8%
unpow288.8%
unpow288.8%
hypot-def91.4%
Simplified91.4%
Taylor expanded in th around 0 44.0%
Taylor expanded in ky around 0 44.2%
if -5.0000000000000001e-181 < (sin.f64 ky) < 5e-206Initial program 65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 63.2%
if 5e-206 < (sin.f64 ky) Initial program 94.6%
associate-*l/91.7%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.3%
Final simplification53.5%
(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 89.8%
associate-*l/86.1%
associate-*r/89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -2.3e-189) (fabs (sin th)) (if (<= ky 1.2e-236) (/ ky (/ (sin kx) th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.3e-189) {
tmp = fabs(sin(th));
} else if (ky <= 1.2e-236) {
tmp = ky / (sin(kx) / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-2.3d-189)) then
tmp = abs(sin(th))
else if (ky <= 1.2d-236) then
tmp = ky / (sin(kx) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.3e-189) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 1.2e-236) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2.3e-189: tmp = math.fabs(math.sin(th)) elif ky <= 1.2e-236: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2.3e-189) tmp = abs(sin(th)); elseif (ky <= 1.2e-236) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -2.3e-189) tmp = abs(sin(th)); elseif (ky <= 1.2e-236) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2.3e-189], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 1.2e-236], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2.3 \cdot 10^{-189}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 1.2 \cdot 10^{-236}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -2.2999999999999998e-189Initial program 97.0%
associate-*l/94.0%
associate-*r/96.9%
+-commutative96.9%
unpow296.9%
unpow296.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 21.9%
add-sqr-sqrt11.9%
sqrt-unprod37.1%
pow237.1%
Applied egg-rr37.1%
*-commutative37.1%
associate-/r/37.2%
*-inverses37.2%
/-rgt-identity37.2%
unpow237.2%
rem-sqrt-square37.8%
Simplified37.8%
if -2.2999999999999998e-189 < ky < 1.2000000000000001e-236Initial program 66.7%
associate-*l/60.3%
+-commutative60.3%
unpow260.3%
unpow260.3%
hypot-def89.2%
Simplified89.2%
Taylor expanded in th around 0 35.8%
Taylor expanded in ky around 0 35.4%
associate-/l*43.6%
Simplified43.6%
if 1.2000000000000001e-236 < ky Initial program 92.2%
associate-*l/88.9%
associate-*r/92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 37.0%
Final simplification38.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -1.9e+33)
(sin th)
(if (<= ky -1.4e-114)
(- th)
(if (<= ky 7e-237) (/ ky (/ (sin kx) th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.9e+33) {
tmp = sin(th);
} else if (ky <= -1.4e-114) {
tmp = -th;
} else if (ky <= 7e-237) {
tmp = ky / (sin(kx) / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.9d+33)) then
tmp = sin(th)
else if (ky <= (-1.4d-114)) then
tmp = -th
else if (ky <= 7d-237) then
tmp = ky / (sin(kx) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.9e+33) {
tmp = Math.sin(th);
} else if (ky <= -1.4e-114) {
tmp = -th;
} else if (ky <= 7e-237) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.9e+33: tmp = math.sin(th) elif ky <= -1.4e-114: tmp = -th elif ky <= 7e-237: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.9e+33) tmp = sin(th); elseif (ky <= -1.4e-114) tmp = Float64(-th); elseif (ky <= 7e-237) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.9e+33) tmp = sin(th); elseif (ky <= -1.4e-114) tmp = -th; elseif (ky <= 7e-237) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.9e+33], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.4e-114], (-th), If[LessEqual[ky, 7e-237], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.9 \cdot 10^{+33}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.4 \cdot 10^{-114}:\\
\;\;\;\;-th\\
\mathbf{elif}\;ky \leq 7 \cdot 10^{-237}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.90000000000000001e33 or 6.99999999999999966e-237 < ky Initial program 95.1%
associate-*l/93.0%
associate-*r/95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 35.9%
if -1.90000000000000001e33 < ky < -1.4000000000000001e-114Initial program 99.7%
associate-*l/94.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.9%
sqrt-unprod32.2%
pow232.2%
Applied egg-rr32.2%
*-commutative32.2%
associate-/r/32.3%
*-inverses32.3%
/-rgt-identity32.3%
Simplified32.3%
Taylor expanded in th around 0 20.2%
unpow220.2%
Simplified20.2%
Taylor expanded in th around -inf 32.6%
neg-mul-132.6%
Simplified32.6%
if -1.4000000000000001e-114 < ky < 6.99999999999999966e-237Initial program 71.1%
associate-*l/63.5%
+-commutative63.5%
unpow263.5%
unpow263.5%
hypot-def89.1%
Simplified89.1%
Taylor expanded in th around 0 36.6%
Taylor expanded in ky around 0 33.0%
associate-/l*38.8%
Simplified38.8%
Final simplification36.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.9e+33) (sin th) (if (<= ky -1.85e-115) (- th) (if (<= ky 3e-251) 0.0 (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.9e+33) {
tmp = sin(th);
} else if (ky <= -1.85e-115) {
tmp = -th;
} else if (ky <= 3e-251) {
tmp = 0.0;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.9d+33)) then
tmp = sin(th)
else if (ky <= (-1.85d-115)) then
tmp = -th
else if (ky <= 3d-251) then
tmp = 0.0d0
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.9e+33) {
tmp = Math.sin(th);
} else if (ky <= -1.85e-115) {
tmp = -th;
} else if (ky <= 3e-251) {
tmp = 0.0;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.9e+33: tmp = math.sin(th) elif ky <= -1.85e-115: tmp = -th elif ky <= 3e-251: tmp = 0.0 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.9e+33) tmp = sin(th); elseif (ky <= -1.85e-115) tmp = Float64(-th); elseif (ky <= 3e-251) tmp = 0.0; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.9e+33) tmp = sin(th); elseif (ky <= -1.85e-115) tmp = -th; elseif (ky <= 3e-251) tmp = 0.0; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.9e+33], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.85e-115], (-th), If[LessEqual[ky, 3e-251], 0.0, N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.9 \cdot 10^{+33}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.85 \cdot 10^{-115}:\\
\;\;\;\;-th\\
\mathbf{elif}\;ky \leq 3 \cdot 10^{-251}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.90000000000000001e33 or 2.9999999999999999e-251 < ky Initial program 93.5%
associate-*l/91.4%
associate-*r/93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 35.4%
if -1.90000000000000001e33 < ky < -1.85e-115Initial program 99.7%
associate-*l/94.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.9%
sqrt-unprod32.2%
pow232.2%
Applied egg-rr32.2%
*-commutative32.2%
associate-/r/32.3%
*-inverses32.3%
/-rgt-identity32.3%
Simplified32.3%
Taylor expanded in th around 0 20.2%
unpow220.2%
Simplified20.2%
Taylor expanded in th around -inf 32.6%
neg-mul-132.6%
Simplified32.6%
if -1.85e-115 < ky < 2.9999999999999999e-251Initial program 74.6%
associate-*l/66.7%
associate-*r/74.6%
+-commutative74.6%
unpow274.6%
unpow274.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.9%
add-sqr-sqrt2.2%
sqrt-unprod33.2%
pow233.2%
Applied egg-rr33.2%
*-commutative33.2%
associate-/r/33.2%
*-inverses33.2%
/-rgt-identity33.2%
Simplified33.2%
sqrt-pow13.9%
metadata-eval3.9%
pow13.9%
expm1-log1p-u3.9%
expm1-udef28.9%
Applied egg-rr28.9%
Taylor expanded in th around 0 30.0%
Final simplification33.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -6.2e-114) (- th) (if (<= ky 2.6e-244) 0.0 th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.2e-114) {
tmp = -th;
} else if (ky <= 2.6e-244) {
tmp = 0.0;
} 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 <= (-6.2d-114)) then
tmp = -th
else if (ky <= 2.6d-244) then
tmp = 0.0d0
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.2e-114) {
tmp = -th;
} else if (ky <= 2.6e-244) {
tmp = 0.0;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -6.2e-114: tmp = -th elif ky <= 2.6e-244: tmp = 0.0 else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -6.2e-114) tmp = Float64(-th); elseif (ky <= 2.6e-244) tmp = 0.0; else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -6.2e-114) tmp = -th; elseif (ky <= 2.6e-244) tmp = 0.0; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -6.2e-114], (-th), If[LessEqual[ky, 2.6e-244], 0.0, th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6.2 \cdot 10^{-114}:\\
\;\;\;\;-th\\
\mathbf{elif}\;ky \leq 2.6 \cdot 10^{-244}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -6.2e-114Initial program 99.8%
associate-*l/98.2%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 25.4%
add-sqr-sqrt13.9%
sqrt-unprod34.7%
pow234.7%
Applied egg-rr34.7%
*-commutative34.7%
associate-/r/34.8%
*-inverses34.8%
/-rgt-identity34.8%
Simplified34.8%
Taylor expanded in th around 0 14.0%
unpow214.0%
Simplified14.0%
Taylor expanded in th around -inf 25.9%
neg-mul-125.9%
Simplified25.9%
if -6.2e-114 < ky < 2.6000000000000001e-244Initial program 72.2%
associate-*l/64.5%
associate-*r/72.2%
+-commutative72.2%
unpow272.2%
unpow272.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 4.1%
add-sqr-sqrt2.5%
sqrt-unprod32.4%
pow232.4%
Applied egg-rr32.4%
*-commutative32.4%
associate-/r/32.4%
*-inverses32.4%
/-rgt-identity32.4%
Simplified32.4%
sqrt-pow14.1%
metadata-eval4.1%
pow14.1%
expm1-log1p-u4.1%
expm1-udef28.3%
Applied egg-rr28.3%
Taylor expanded in th around 0 29.1%
if 2.6000000000000001e-244 < ky Initial program 91.4%
associate-*l/88.1%
associate-*r/91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 36.6%
Taylor expanded in th around 0 23.4%
Final simplification25.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-246) (- th) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-246) {
tmp = -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 <= 8d-246) then
tmp = -th
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-246) {
tmp = -th;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8e-246: tmp = -th else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8e-246) tmp = Float64(-th); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8e-246) tmp = -th; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-246], (-th), th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8 \cdot 10^{-246}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 7.99999999999999965e-246Initial program 88.7%
associate-*l/84.7%
associate-*r/88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 16.9%
add-sqr-sqrt9.3%
sqrt-unprod33.8%
pow233.8%
Applied egg-rr33.8%
*-commutative33.8%
associate-/r/33.8%
*-inverses33.8%
/-rgt-identity33.8%
Simplified33.8%
Taylor expanded in th around 0 17.0%
unpow217.0%
Simplified17.0%
Taylor expanded in th around -inf 17.9%
neg-mul-117.9%
Simplified17.9%
if 7.99999999999999965e-246 < ky Initial program 91.4%
associate-*l/88.1%
associate-*r/91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 36.6%
Taylor expanded in th around 0 23.4%
Final simplification20.2%
(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 89.8%
associate-*l/86.1%
associate-*r/89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 15.3%
Final simplification15.3%
herbie shell --seed 2023175
(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)))