
(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 20 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 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))))
(if (<= (sin ky) -0.635)
t_1
(if (<= (sin ky) -0.18)
(fabs (sin th))
(if (<= (sin ky) -0.005)
t_1
(if (<= (sin ky) 1e-15)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = th / (hypot(sin(kx), sin(ky)) / sin(ky));
double tmp;
if (sin(ky) <= -0.635) {
tmp = t_1;
} else if (sin(ky) <= -0.18) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.005) {
tmp = t_1;
} else if (sin(ky) <= 1e-15) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
double tmp;
if (Math.sin(ky) <= -0.635) {
tmp = t_1;
} else if (Math.sin(ky) <= -0.18) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.005) {
tmp = t_1;
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) tmp = 0 if math.sin(ky) <= -0.635: tmp = t_1 elif math.sin(ky) <= -0.18: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.005: tmp = t_1 elif math.sin(ky) <= 1e-15: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) tmp = 0.0 if (sin(ky) <= -0.635) tmp = t_1; elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = t_1; elseif (sin(ky) <= 1e-15) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = th / (hypot(sin(kx), sin(ky)) / sin(ky)); tmp = 0.0; if (sin(ky) <= -0.635) tmp = t_1; elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = t_1; elseif (sin(ky) <= 1e-15) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.635], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.18], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{if}\;\sin ky \leq -0.635:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -0.18:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.005:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.63500000000000001 or -0.17999999999999999 < (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
*-commutative99.8%
clear-num99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.7%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 56.1%
if -0.63500000000000001 < (sin.f64 ky) < -0.17999999999999999Initial program 99.8%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt0.6%
sqrt-unprod39.8%
pow239.8%
Applied egg-rr39.8%
unpow239.8%
rem-sqrt-square47.2%
Simplified47.2%
if -0.0050000000000000001 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.2%
associate-*l/78.7%
*-commutative78.7%
associate-*l/81.2%
+-commutative81.2%
unpow281.2%
unpow281.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification77.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.635)
(/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))
(if (<= (sin ky) -0.18)
(fabs (sin th))
(if (<= (sin ky) -0.005)
(/ (sin ky) (/ (hypot (sin ky) (sin kx)) th))
(if (<= (sin ky) 1e-15)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.635) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else if (sin(ky) <= -0.18) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.005) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th);
} else if (sin(ky) <= 1e-15) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.635) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else if (Math.sin(ky) <= -0.18) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.005) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th);
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.635: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) elif math.sin(ky) <= -0.18: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.005: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / th) elif math.sin(ky) <= 1e-15: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.635) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) / th)); elseif (sin(ky) <= 1e-15) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.635) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th); elseif (sin(ky) <= 1e-15) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.635], N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.18], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.635:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq -0.18:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.005:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.63500000000000001Initial program 99.9%
*-commutative99.9%
clear-num99.9%
+-commutative99.9%
unpow299.9%
unpow299.9%
hypot-udef99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 50.0%
if -0.63500000000000001 < (sin.f64 ky) < -0.17999999999999999Initial program 99.8%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt0.6%
sqrt-unprod39.8%
pow239.8%
Applied egg-rr39.8%
unpow239.8%
rem-sqrt-square47.2%
Simplified47.2%
if -0.17999999999999999 < (sin.f64 ky) < -0.0050000000000000001Initial program 99.3%
associate-*l/99.2%
*-commutative99.2%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
expm1-log1p-u99.3%
Applied egg-rr99.3%
*-commutative99.3%
clear-num99.4%
un-div-inv99.3%
expm1-log1p-u99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 85.4%
if -0.0050000000000000001 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.2%
associate-*l/78.7%
*-commutative78.7%
associate-*l/81.2%
+-commutative81.2%
unpow281.2%
unpow281.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification77.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin kx) (sin ky))))
(if (<= (sin ky) -0.635)
(/ th (/ t_1 (sin ky)))
(if (<= (sin ky) -0.18)
(fabs (sin th))
(if (<= (sin ky) -0.005)
(/ (sin ky) (/ (hypot (sin ky) (sin kx)) th))
(if (<= (sin ky) 1e-15) (/ (sin th) (/ t_1 ky)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double tmp;
if (sin(ky) <= -0.635) {
tmp = th / (t_1 / sin(ky));
} else if (sin(ky) <= -0.18) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.005) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th);
} else if (sin(ky) <= 1e-15) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (Math.sin(ky) <= -0.635) {
tmp = th / (t_1 / Math.sin(ky));
} else if (Math.sin(ky) <= -0.18) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.005) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th);
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if math.sin(ky) <= -0.635: tmp = th / (t_1 / math.sin(ky)) elif math.sin(ky) <= -0.18: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.005: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / th) elif math.sin(ky) <= 1e-15: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (sin(ky) <= -0.635) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) / th)); elseif (sin(ky) <= 1e-15) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (sin(ky) <= -0.635) tmp = th / (t_1 / sin(ky)); elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th); elseif (sin(ky) <= 1e-15) tmp = sin(th) / (t_1 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.635], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.18], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;\sin ky \leq -0.635:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq -0.18:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.005:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.63500000000000001Initial program 99.9%
*-commutative99.9%
clear-num99.9%
+-commutative99.9%
unpow299.9%
unpow299.9%
hypot-udef99.9%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 50.0%
if -0.63500000000000001 < (sin.f64 ky) < -0.17999999999999999Initial program 99.8%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt0.6%
sqrt-unprod39.8%
pow239.8%
Applied egg-rr39.8%
unpow239.8%
rem-sqrt-square47.2%
Simplified47.2%
if -0.17999999999999999 < (sin.f64 ky) < -0.0050000000000000001Initial program 99.3%
associate-*l/99.2%
*-commutative99.2%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
expm1-log1p-u99.3%
Applied egg-rr99.3%
*-commutative99.3%
clear-num99.4%
un-div-inv99.3%
expm1-log1p-u99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 85.4%
if -0.0050000000000000001 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.2%
*-commutative81.2%
clear-num81.1%
+-commutative81.1%
unpow281.1%
unpow281.1%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 99.7%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification77.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin kx) (sin ky)))
(t_2 (/ (sin ky) (* t_1 (+ (/ 1.0 th) (* th 0.16666666666666666))))))
(if (<= (sin ky) -0.658)
t_2
(if (<= (sin ky) -0.18)
(fabs (sin th))
(if (<= (sin ky) -0.005)
t_2
(if (<= (sin ky) 1e-15) (/ (sin th) (/ t_1 ky)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double t_2 = sin(ky) / (t_1 * ((1.0 / th) + (th * 0.16666666666666666)));
double tmp;
if (sin(ky) <= -0.658) {
tmp = t_2;
} else if (sin(ky) <= -0.18) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.005) {
tmp = t_2;
} else if (sin(ky) <= 1e-15) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double t_2 = Math.sin(ky) / (t_1 * ((1.0 / th) + (th * 0.16666666666666666)));
double tmp;
if (Math.sin(ky) <= -0.658) {
tmp = t_2;
} else if (Math.sin(ky) <= -0.18) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.005) {
tmp = t_2;
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) t_2 = math.sin(ky) / (t_1 * ((1.0 / th) + (th * 0.16666666666666666))) tmp = 0 if math.sin(ky) <= -0.658: tmp = t_2 elif math.sin(ky) <= -0.18: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.005: tmp = t_2 elif math.sin(ky) <= 1e-15: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) t_2 = Float64(sin(ky) / Float64(t_1 * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))) tmp = 0.0 if (sin(ky) <= -0.658) tmp = t_2; elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = t_2; elseif (sin(ky) <= 1e-15) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); t_2 = sin(ky) / (t_1 * ((1.0 / th) + (th * 0.16666666666666666))); tmp = 0.0; if (sin(ky) <= -0.658) tmp = t_2; elseif (sin(ky) <= -0.18) tmp = abs(sin(th)); elseif (sin(ky) <= -0.005) tmp = t_2; elseif (sin(ky) <= 1e-15) tmp = sin(th) / (t_1 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[(t$95$1 * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.658], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.18], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
t_2 := \frac{\sin ky}{t_1 \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{if}\;\sin ky \leq -0.658:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -0.18:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.005:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.658000000000000029 or -0.17999999999999999 < (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
expm1-log1p-u99.6%
Applied egg-rr99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
expm1-log1p-u99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 56.9%
+-commutative56.9%
*-commutative56.9%
+-commutative56.9%
unpow256.9%
unpow256.9%
hypot-def56.9%
associate-*r/56.9%
*-rgt-identity56.9%
*-lft-identity56.9%
associate-*l/56.9%
associate-*r*56.9%
Simplified56.9%
if -0.658000000000000029 < (sin.f64 ky) < -0.17999999999999999Initial program 99.8%
Taylor expanded in kx around 0 2.2%
add-sqr-sqrt0.7%
sqrt-unprod40.8%
pow240.8%
Applied egg-rr40.8%
unpow240.8%
rem-sqrt-square47.6%
Simplified47.6%
if -0.0050000000000000001 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.2%
*-commutative81.2%
clear-num81.1%
+-commutative81.1%
unpow281.1%
unpow281.1%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 99.7%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification77.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) 1e-15)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-15) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-15: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod22.6%
pow222.6%
Applied egg-rr22.6%
unpow222.6%
rem-sqrt-square31.5%
Simplified31.5%
if -0.0100000000000000002 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.3%
+-commutative81.3%
unpow281.3%
unpow281.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.2%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification71.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 1e-15)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-15) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-15: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod22.9%
pow222.9%
Applied egg-rr22.9%
unpow222.9%
rem-sqrt-square31.9%
Simplified31.9%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 98.6%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification71.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 1e-15)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-15) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-15) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-15: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-15) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-15], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-15}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod22.9%
pow222.9%
Applied egg-rr22.9%
unpow222.9%
rem-sqrt-square31.9%
Simplified31.9%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-15Initial program 81.5%
associate-*l/79.1%
*-commutative79.1%
associate-*l/81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 98.6%
if 1.0000000000000001e-15 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.5%
Final simplification71.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-11)
(fabs (sin th))
(if (<= (sin ky) 1e-35)
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-11) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-35) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-11)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-35) then
tmp = sin(th) * (sin(ky) / abs(sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-11) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-35) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-11: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-35: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-11], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-11}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999939e-12Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod23.7%
pow223.7%
Applied egg-rr23.7%
unpow223.7%
rem-sqrt-square32.3%
Simplified32.3%
if -9.99999999999999939e-12 < (sin.f64 ky) < 1.00000000000000001e-35Initial program 80.3%
unpow280.3%
sin-mult65.7%
Applied egg-rr65.7%
div-sub65.7%
+-inverses65.7%
+-inverses65.7%
+-inverses65.7%
cos-065.7%
metadata-eval65.7%
count-265.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in ky around 0 46.2%
sqr-sin-a61.5%
rem-sqrt-square72.0%
Applied egg-rr72.0%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification59.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-11)
(fabs (sin th))
(if (<= (sin ky) -4e-163)
(* ky (* (sin th) (sqrt (/ 1.0 (+ 0.5 (* -0.5 (cos (* kx 2.0))))))))
(if (<= (sin ky) 1e-35) (* ky (/ (sin th) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-11) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-163) {
tmp = ky * (sin(th) * sqrt((1.0 / (0.5 + (-0.5 * cos((kx * 2.0)))))));
} else if (sin(ky) <= 1e-35) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-11)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-4d-163)) then
tmp = ky * (sin(th) * sqrt((1.0d0 / (0.5d0 + ((-0.5d0) * cos((kx * 2.0d0)))))))
else if (sin(ky) <= 1d-35) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-11) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-163) {
tmp = ky * (Math.sin(th) * Math.sqrt((1.0 / (0.5 + (-0.5 * Math.cos((kx * 2.0)))))));
} else if (Math.sin(ky) <= 1e-35) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-11: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-163: tmp = ky * (math.sin(th) * math.sqrt((1.0 / (0.5 + (-0.5 * math.cos((kx * 2.0))))))) elif math.sin(ky) <= 1e-35: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-163) tmp = Float64(ky * Float64(sin(th) * sqrt(Float64(1.0 / Float64(0.5 + Float64(-0.5 * cos(Float64(kx * 2.0)))))))); elseif (sin(ky) <= 1e-35) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-163) tmp = ky * (sin(th) * sqrt((1.0 / (0.5 + (-0.5 * cos((kx * 2.0))))))); elseif (sin(ky) <= 1e-35) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-11], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-163], N[(ky * N[(N[Sin[th], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-11}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-163}:\\
\;\;\;\;ky \cdot \left(\sin th \cdot \sqrt{\frac{1}{0.5 + -0.5 \cdot \cos \left(kx \cdot 2\right)}}\right)\\
\mathbf{elif}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999939e-12Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod23.7%
pow223.7%
Applied egg-rr23.7%
unpow223.7%
rem-sqrt-square32.3%
Simplified32.3%
if -9.99999999999999939e-12 < (sin.f64 ky) < -3.99999999999999969e-163Initial program 96.6%
unpow296.6%
sin-mult91.3%
Applied egg-rr91.3%
div-sub91.3%
+-inverses91.3%
+-inverses91.3%
+-inverses91.3%
cos-091.3%
metadata-eval91.3%
count-291.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in ky around 0 48.6%
associate-*l*48.8%
cancel-sign-sub-inv48.8%
metadata-eval48.8%
*-commutative48.8%
Simplified48.8%
if -3.99999999999999969e-163 < (sin.f64 ky) < 1.00000000000000001e-35Initial program 73.7%
associate-*l/71.4%
*-commutative71.4%
associate-*l/73.8%
+-commutative73.8%
unpow273.8%
unpow273.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 55.7%
Taylor expanded in ky around 0 55.7%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification51.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-11)
(fabs (sin th))
(if (<= (sin ky) -4e-163)
(* (sin th) (/ ky (sqrt (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin ky) 1e-35) (* ky (/ (sin th) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-11) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-163) {
tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(ky) <= 1e-35) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-11)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-4d-163)) then
tmp = sin(th) * (ky / sqrt((0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(ky) <= 1d-35) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-11) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-163) {
tmp = Math.sin(th) * (ky / Math.sqrt((0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(ky) <= 1e-35) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-11: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-163: tmp = math.sin(th) * (ky / math.sqrt((0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(ky) <= 1e-35: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-163) tmp = Float64(sin(th) * Float64(ky / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(ky) <= 1e-35) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-11) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-163) tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(ky) <= 1e-35) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-11], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-163], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-11}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-163}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999939e-12Initial program 99.8%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.1%
sqrt-unprod23.7%
pow223.7%
Applied egg-rr23.7%
unpow223.7%
rem-sqrt-square32.3%
Simplified32.3%
if -9.99999999999999939e-12 < (sin.f64 ky) < -3.99999999999999969e-163Initial program 96.6%
unpow296.6%
sin-mult91.3%
Applied egg-rr91.3%
div-sub91.3%
+-inverses91.3%
+-inverses91.3%
+-inverses91.3%
cos-091.3%
metadata-eval91.3%
count-291.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in ky around 0 48.6%
Taylor expanded in ky around 0 48.6%
if -3.99999999999999969e-163 < (sin.f64 ky) < 1.00000000000000001e-35Initial program 73.7%
associate-*l/71.4%
*-commutative71.4%
associate-*l/73.8%
+-commutative73.8%
unpow273.8%
unpow273.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 55.7%
Taylor expanded in ky around 0 55.7%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification51.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-94) (fabs (sin th)) (if (<= (sin ky) 1e-35) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-94) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-35) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-94)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-35) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-94) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-35) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-94: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-35: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-94) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-94) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) 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], -5e-94], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -4.9999999999999995e-94Initial program 99.8%
Taylor expanded in kx around 0 2.4%
add-sqr-sqrt1.2%
sqrt-unprod24.3%
pow224.3%
Applied egg-rr24.3%
unpow224.3%
rem-sqrt-square32.2%
Simplified32.2%
if -4.9999999999999995e-94 < (sin.f64 ky) < 1.00000000000000001e-35Initial program 76.8%
+-commutative76.8%
unpow276.8%
unpow276.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.5%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-94) (fabs (sin th)) (if (<= (sin ky) 1e-35) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-94) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-35) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-94)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-35) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-94) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-35) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-94: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-35: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-94) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-94) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-35) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-94], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-94}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -4.9999999999999995e-94Initial program 99.8%
Taylor expanded in kx around 0 2.4%
add-sqr-sqrt1.2%
sqrt-unprod24.3%
pow224.3%
Applied egg-rr24.3%
unpow224.3%
rem-sqrt-square32.2%
Simplified32.2%
if -4.9999999999999995e-94 < (sin.f64 ky) < 1.00000000000000001e-35Initial program 76.8%
associate-*l/73.8%
*-commutative73.8%
associate-*l/76.9%
+-commutative76.9%
unpow276.9%
unpow276.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 52.5%
Taylor expanded in ky around 0 52.5%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2.35e-222) (fabs (sin th)) (if (<= (sin ky) 5.2e-204) 0.0 (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2.35e-222) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5.2e-204) {
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 (sin(ky) <= (-2.35d-222)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5.2d-204) 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 (Math.sin(ky) <= -2.35e-222) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5.2e-204) {
tmp = 0.0;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2.35e-222: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5.2e-204: tmp = 0.0 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2.35e-222) tmp = abs(sin(th)); elseif (sin(ky) <= 5.2e-204) tmp = 0.0; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2.35e-222) tmp = abs(sin(th)); elseif (sin(ky) <= 5.2e-204) tmp = 0.0; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2.35e-222], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5.2e-204], 0.0, N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2.35 \cdot 10^{-222}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5.2 \cdot 10^{-204}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.3499999999999999e-222Initial program 92.2%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod23.8%
pow223.8%
Applied egg-rr23.8%
unpow223.8%
rem-sqrt-square28.9%
Simplified28.9%
if -2.3499999999999999e-222 < (sin.f64 ky) < 5.19999999999999965e-204Initial program 71.1%
Taylor expanded in kx around 0 7.4%
add-log-exp28.3%
Applied egg-rr28.3%
Taylor expanded in th around 0 29.3%
if 5.19999999999999965e-204 < (sin.f64 ky) Initial program 96.2%
Taylor expanded in kx around 0 55.2%
Final simplification40.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4.4e-202) (* th (* (sin ky) (+ (* kx 0.16666666666666666) (/ 1.0 kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4.4e-202) {
tmp = th * (sin(ky) * ((kx * 0.16666666666666666) + (1.0 / 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) <= 4.4d-202) then
tmp = th * (sin(ky) * ((kx * 0.16666666666666666d0) + (1.0d0 / 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) <= 4.4e-202) {
tmp = th * (Math.sin(ky) * ((kx * 0.16666666666666666) + (1.0 / kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 4.4e-202: tmp = th * (math.sin(ky) * ((kx * 0.16666666666666666) + (1.0 / kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4.4e-202) tmp = Float64(th * Float64(sin(ky) * Float64(Float64(kx * 0.16666666666666666) + Float64(1.0 / kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 4.4e-202) tmp = th * (sin(ky) * ((kx * 0.16666666666666666) + (1.0 / kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4.4e-202], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[(N[(kx * 0.16666666666666666), $MachinePrecision] + N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4.4 \cdot 10^{-202}:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \left(kx \cdot 0.16666666666666666 + \frac{1}{kx}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.40000000000000016e-202Initial program 86.9%
associate-*l/85.5%
*-commutative85.5%
associate-*l/86.8%
+-commutative86.8%
unpow286.8%
unpow286.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 29.5%
Taylor expanded in kx around 0 14.4%
Taylor expanded in th around 0 9.5%
if 4.40000000000000016e-202 < (sin.f64 ky) Initial program 97.1%
Taylor expanded in kx around 0 55.6%
Final simplification29.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.35e+14) (sin th) (+ (+ (sin th) 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.35e+14) {
tmp = sin(th);
} else {
tmp = (sin(th) + 1.0) + -1.0;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.35d+14) then
tmp = sin(th)
else
tmp = (sin(th) + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.35e+14) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.35e+14: tmp = math.sin(th) else: tmp = (math.sin(th) + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.35e+14) tmp = sin(th); else tmp = Float64(Float64(sin(th) + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.35e+14) tmp = sin(th); else tmp = (sin(th) + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.35e+14], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.35 \cdot 10^{+14}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 1.35e14Initial program 88.6%
Taylor expanded in kx around 0 32.1%
if 1.35e14 < kx Initial program 99.5%
Taylor expanded in kx around 0 9.2%
expm1-log1p-u9.2%
Applied egg-rr9.2%
expm1-udef18.6%
log1p-udef18.6%
rem-exp-log18.6%
+-commutative18.6%
Applied egg-rr18.6%
Final simplification28.7%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -8500000000.0) (not (<= ky 1.35e-204))) (sin th) 0.0))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -8500000000.0) || !(ky <= 1.35e-204)) {
tmp = sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-8500000000.0d0)) .or. (.not. (ky <= 1.35d-204))) then
tmp = sin(th)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -8500000000.0) || !(ky <= 1.35e-204)) {
tmp = Math.sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -8500000000.0) or not (ky <= 1.35e-204): tmp = math.sin(th) else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -8500000000.0) || !(ky <= 1.35e-204)) tmp = sin(th); else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -8500000000.0) || ~((ky <= 1.35e-204))) tmp = sin(th); else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -8500000000.0], N[Not[LessEqual[ky, 1.35e-204]], $MachinePrecision]], N[Sin[th], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -8500000000 \lor \neg \left(ky \leq 1.35 \cdot 10^{-204}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if ky < -8.5e9 or 1.34999999999999996e-204 < ky Initial program 97.5%
Taylor expanded in kx around 0 36.4%
if -8.5e9 < ky < 1.34999999999999996e-204Initial program 78.0%
Taylor expanded in kx around 0 4.7%
add-log-exp16.8%
Applied egg-rr16.8%
Taylor expanded in th around 0 17.8%
Final simplification30.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.26e+86) (expm1 th) 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.26e+86) {
tmp = expm1(th);
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.26e+86) {
tmp = Math.expm1(th);
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.26e+86: tmp = math.expm1(th) else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.26e+86) tmp = expm1(th); else tmp = 0.0; end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.26e+86], N[(Exp[th] - 1), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.26 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{expm1}\left(th\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 1.25999999999999999e86Initial program 89.4%
Taylor expanded in kx around 0 30.3%
expm1-log1p-u30.3%
Applied egg-rr30.3%
Taylor expanded in th around 0 19.2%
if 1.25999999999999999e86 < kx Initial program 99.5%
Taylor expanded in kx around 0 9.4%
add-log-exp22.6%
Applied egg-rr22.6%
Taylor expanded in th around 0 19.3%
Final simplification19.2%
(FPCore (kx ky th) :precision binary64 (expm1 th))
double code(double kx, double ky, double th) {
return expm1(th);
}
public static double code(double kx, double ky, double th) {
return Math.expm1(th);
}
def code(kx, ky, th): return math.expm1(th)
function code(kx, ky, th) return expm1(th) end
code[kx_, ky_, th_] := N[(Exp[th] - 1), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{expm1}\left(th\right)
\end{array}
Initial program 91.3%
Taylor expanded in kx around 0 26.4%
expm1-log1p-u26.4%
Applied egg-rr26.4%
Taylor expanded in th around 0 16.6%
Final simplification16.6%
(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 91.3%
Taylor expanded in kx around 0 26.4%
Taylor expanded in th around 0 15.9%
Final simplification15.9%
herbie shell --seed 2023311
(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)))