
(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 16 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 94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.15) (fabs (sin th)) (if (<= (sin ky) 0.0001) (/ ky (/ (hypot ky (sin kx)) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 0.0001) {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.15) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 0.0001) {
tmp = ky / (Math.hypot(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.15: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 0.0001: tmp = ky / (math.hypot(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.15) tmp = abs(sin(th)); elseif (sin(ky) <= 0.0001) tmp = Float64(ky / Float64(hypot(ky, 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.15) tmp = abs(sin(th)); elseif (sin(ky) <= 0.0001) tmp = ky / (hypot(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.15], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0001], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.15:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 0.0001:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.5%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square25.8%
Simplified25.8%
if -0.149999999999999994 < (sin.f64 ky) < 1.00000000000000005e-4Initial program 90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
associate-*l/86.4%
associate-/l*90.8%
unpow290.8%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 97.0%
Taylor expanded in ky around 0 98.5%
if 1.00000000000000005e-4 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 51.6%
Final simplification70.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (* (/ 1.0 (sin ky)) (* th (fabs (sin ky)))) (if (<= (sin ky) 0.0001) (/ ky (/ (hypot ky (sin kx)) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = (1.0 / sin(ky)) * (th * fabs(sin(ky)));
} else if (sin(ky) <= 0.0001) {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
} 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 = (1.0 / Math.sin(ky)) * (th * Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 0.0001) {
tmp = ky / (Math.hypot(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.02: tmp = (1.0 / math.sin(ky)) * (th * math.fabs(math.sin(ky))) elif math.sin(ky) <= 0.0001: tmp = ky / (math.hypot(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.02) tmp = Float64(Float64(1.0 / sin(ky)) * Float64(th * abs(sin(ky)))); elseif (sin(ky) <= 0.0001) tmp = Float64(ky / Float64(hypot(ky, 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.02) tmp = (1.0 / sin(ky)) * (th * abs(sin(ky))); elseif (sin(ky) <= 0.0001) tmp = ky / (hypot(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.02], N[(N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(th * N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0001], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{1}{\sin ky} \cdot \left(th \cdot \left|\sin ky\right|\right)\\
\mathbf{elif}\;\sin ky \leq 0.0001:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
associate-*r/99.7%
hypot-undefine99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
clear-num99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
associate-/r/99.5%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in th around 0 54.7%
Taylor expanded in kx around 0 3.5%
add-sqr-sqrt0.0%
sqrt-prod33.9%
rem-sqrt-square33.9%
Applied egg-rr33.9%
if -0.0200000000000000004 < (sin.f64 ky) < 1.00000000000000005e-4Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/86.0%
associate-/l*90.5%
unpow290.5%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
Taylor expanded in ky around 0 99.1%
if 1.00000000000000005e-4 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 51.6%
Final simplification71.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.0005) (* (/ 1.0 (hypot (sin kx) ky)) (* ky th)) (if (<= (sin kx) 5e-141) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.0005) {
tmp = (1.0 / hypot(sin(kx), ky)) * (ky * th);
} else if (sin(kx) <= 5e-141) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.0005) {
tmp = (1.0 / Math.hypot(Math.sin(kx), ky)) * (ky * th);
} else if (Math.sin(kx) <= 5e-141) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.0005: tmp = (1.0 / math.hypot(math.sin(kx), ky)) * (ky * th) elif math.sin(kx) <= 5e-141: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.0005) tmp = Float64(Float64(1.0 / hypot(sin(kx), ky)) * Float64(ky * th)); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.0005) tmp = (1.0 / hypot(sin(kx), ky)) * (ky * th); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0005], N[(N[(1.0 / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ky * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-141], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.0005:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(\sin kx, ky\right)} \cdot \left(ky \cdot th\right)\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
clear-num99.1%
+-commutative99.1%
unpow299.1%
unpow299.1%
hypot-undefine99.2%
Applied egg-rr99.2%
associate-/r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in th around 0 56.6%
Taylor expanded in ky around 0 33.2%
Taylor expanded in ky around 0 34.8%
if -5.0000000000000001e-4 < (sin.f64 kx) < 4.9999999999999999e-141Initial program 87.5%
unpow287.5%
sqr-neg87.5%
sin-neg87.5%
sin-neg87.5%
unpow287.5%
associate-*l/83.5%
associate-/l*87.3%
unpow287.3%
Simplified99.7%
Taylor expanded in kx around 0 34.1%
if 4.9999999999999999e-141 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/97.0%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 54.5%
Final simplification41.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.0005) (* (/ 1.0 (hypot (sin kx) ky)) (* ky th)) (if (<= (sin kx) 5e-141) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.0005) {
tmp = (1.0 / hypot(sin(kx), ky)) * (ky * th);
} else if (sin(kx) <= 5e-141) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.0005) {
tmp = (1.0 / Math.hypot(Math.sin(kx), ky)) * (ky * th);
} else if (Math.sin(kx) <= 5e-141) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.0005: tmp = (1.0 / math.hypot(math.sin(kx), ky)) * (ky * th) elif math.sin(kx) <= 5e-141: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.0005) tmp = Float64(Float64(1.0 / hypot(sin(kx), ky)) * Float64(ky * th)); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.0005) tmp = (1.0 / hypot(sin(kx), ky)) * (ky * th); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0005], N[(N[(1.0 / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision] * N[(ky * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-141], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.0005:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(\sin kx, ky\right)} \cdot \left(ky \cdot th\right)\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
clear-num99.1%
+-commutative99.1%
unpow299.1%
unpow299.1%
hypot-undefine99.2%
Applied egg-rr99.2%
associate-/r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in th around 0 56.6%
Taylor expanded in ky around 0 33.2%
Taylor expanded in ky around 0 34.8%
if -5.0000000000000001e-4 < (sin.f64 kx) < 4.9999999999999999e-141Initial program 87.5%
unpow287.5%
sqr-neg87.5%
sin-neg87.5%
sin-neg87.5%
unpow287.5%
associate-*l/83.5%
associate-/l*87.3%
unpow287.3%
Simplified99.7%
Taylor expanded in kx around 0 34.1%
if 4.9999999999999999e-141 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 54.5%
Final simplification41.3%
(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 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/92.5%
associate-/l*94.9%
unpow294.9%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-24) (* ky (/ (sin th) (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-24) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-24) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-24) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-24: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-24) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-24) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-24], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-24}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod21.3%
pow221.3%
Applied egg-rr21.3%
unpow221.3%
rem-sqrt-square25.9%
Simplified25.9%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999924e-25Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/85.4%
associate-/l*90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in ky around 0 44.6%
associate-/l*48.4%
Simplified48.4%
if 9.99999999999999924e-25 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 52.7%
Final simplification43.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-24) (* (sin th) (/ 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-24) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-24) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-24) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-24: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-24) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-24) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-24], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-24}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod21.3%
pow221.3%
Applied egg-rr21.3%
unpow221.3%
rem-sqrt-square25.9%
Simplified25.9%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999924e-25Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 48.4%
if 9.99999999999999924e-25 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 52.7%
Final simplification43.5%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.32) (* (sin ky) (/ th (hypot (sin kx) (sin ky)))) (/ ky (/ (hypot ky (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.32) {
tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
} else {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.32) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.32: tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.32) tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky)))); else tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.32) tmp = sin(ky) * (th / hypot(sin(kx), sin(ky))); else tmp = ky / (hypot(ky, sin(kx)) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.32], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.32:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\end{array}
\end{array}
if th < 0.320000000000000007Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/91.6%
associate-/l*94.6%
unpow294.6%
Simplified99.7%
associate-*r/94.2%
hypot-undefine91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
clear-num90.9%
+-commutative90.9%
unpow290.9%
unpow290.9%
hypot-undefine93.4%
Applied egg-rr93.4%
associate-/r/94.0%
hypot-undefine91.4%
unpow291.4%
unpow291.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-undefine94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in th around 0 58.7%
associate-*l/58.7%
*-un-lft-identity58.7%
*-commutative58.7%
hypot-undefine58.0%
+-commutative58.0%
hypot-undefine58.7%
Applied egg-rr58.7%
associate-*r/64.2%
hypot-undefine61.0%
unpow261.0%
unpow261.0%
+-commutative61.0%
unpow261.0%
unpow261.0%
hypot-define64.2%
Simplified64.2%
if 0.320000000000000007 < th Initial program 96.1%
unpow296.1%
sqr-neg96.1%
sin-neg96.1%
sin-neg96.1%
unpow296.1%
associate-*l/96.0%
associate-/l*96.1%
unpow296.1%
Simplified99.5%
clear-num99.2%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.1%
Taylor expanded in ky around 0 68.4%
Final simplification65.1%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.32) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (/ ky (/ (hypot ky (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.32) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.32) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.32: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.32) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.32) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = ky / (hypot(ky, sin(kx)) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.32], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.32:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\end{array}
\end{array}
if th < 0.320000000000000007Initial program 94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 64.2%
if 0.320000000000000007 < th Initial program 96.1%
unpow296.1%
sqr-neg96.1%
sin-neg96.1%
sin-neg96.1%
unpow296.1%
associate-*l/96.0%
associate-/l*96.1%
unpow296.1%
Simplified99.5%
clear-num99.2%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.1%
Taylor expanded in ky around 0 68.4%
Final simplification65.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.8e-87) (sin th) (fabs (* th (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.8e-87) {
tmp = sin(th);
} else {
tmp = fabs((th * (ky / sin(kx))));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.8d-87) then
tmp = sin(th)
else
tmp = abs((th * (ky / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.8e-87) {
tmp = Math.sin(th);
} else {
tmp = Math.abs((th * (ky / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.8e-87: tmp = math.sin(th) else: tmp = math.fabs((th * (ky / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.8e-87) tmp = sin(th); else tmp = abs(Float64(th * Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.8e-87) tmp = sin(th); else tmp = abs((th * (ky / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.8e-87], N[Sin[th], $MachinePrecision], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.8 \cdot 10^{-87}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 1.79999999999999996e-87Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/90.2%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
Taylor expanded in kx around 0 22.8%
if 1.79999999999999996e-87 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/97.8%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/97.9%
hypot-undefine97.8%
unpow297.8%
unpow297.8%
+-commutative97.8%
clear-num96.3%
+-commutative96.3%
unpow296.3%
unpow296.3%
hypot-undefine96.3%
Applied egg-rr96.3%
associate-/r/97.8%
hypot-undefine97.7%
unpow297.7%
unpow297.7%
+-commutative97.7%
unpow297.7%
unpow297.7%
hypot-undefine97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in th around 0 48.8%
Taylor expanded in ky around 0 23.7%
associate-/l*25.4%
Simplified25.4%
add-sqr-sqrt18.7%
sqrt-unprod18.7%
pow218.7%
clear-num18.7%
un-div-inv18.7%
Applied egg-rr18.7%
unpow218.7%
rem-sqrt-square23.4%
associate-/r/23.4%
Simplified23.4%
Final simplification23.0%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky 9.8e-141) (and (not (<= ky 6.1e-66)) (<= ky 2.6e-54))) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 9.8e-141) || (!(ky <= 6.1e-66) && (ky <= 2.6e-54))) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= 9.8d-141) .or. (.not. (ky <= 6.1d-66)) .and. (ky <= 2.6d-54)) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 9.8e-141) || (!(ky <= 6.1e-66) && (ky <= 2.6e-54))) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= 9.8e-141) or (not (ky <= 6.1e-66) and (ky <= 2.6e-54)): tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= 9.8e-141) || (!(ky <= 6.1e-66) && (ky <= 2.6e-54))) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= 9.8e-141) || (~((ky <= 6.1e-66)) && (ky <= 2.6e-54))) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, 9.8e-141], And[N[Not[LessEqual[ky, 6.1e-66]], $MachinePrecision], LessEqual[ky, 2.6e-54]]], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.8 \cdot 10^{-141} \lor \neg \left(ky \leq 6.1 \cdot 10^{-66}\right) \land ky \leq 2.6 \cdot 10^{-54}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 9.80000000000000012e-141 or 6.09999999999999993e-66 < ky < 2.60000000000000002e-54Initial program 92.2%
unpow292.2%
sqr-neg92.2%
sin-neg92.2%
sin-neg92.2%
unpow292.2%
associate-*l/90.2%
associate-/l*92.2%
unpow292.2%
Simplified99.6%
associate-*r/94.5%
hypot-undefine90.2%
unpow290.2%
unpow290.2%
+-commutative90.2%
clear-num89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-undefine93.7%
Applied egg-rr93.7%
associate-/r/94.3%
hypot-undefine90.0%
unpow290.0%
unpow290.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-undefine94.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in th around 0 41.6%
Taylor expanded in ky around 0 17.9%
associate-/l*20.4%
Simplified20.4%
if 9.80000000000000012e-141 < ky < 6.09999999999999993e-66 or 2.60000000000000002e-54 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/96.7%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 30.6%
Final simplification24.1%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 9.5e-141)
(/ ky (/ (sin kx) th))
(if (or (<= ky 5.1e-66) (not (<= ky 2.9e-52)))
(sin th)
(* ky (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.5e-141) {
tmp = ky / (sin(kx) / th);
} else if ((ky <= 5.1e-66) || !(ky <= 2.9e-52)) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 9.5d-141) then
tmp = ky / (sin(kx) / th)
else if ((ky <= 5.1d-66) .or. (.not. (ky <= 2.9d-52))) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.5e-141) {
tmp = ky / (Math.sin(kx) / th);
} else if ((ky <= 5.1e-66) || !(ky <= 2.9e-52)) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.5e-141: tmp = ky / (math.sin(kx) / th) elif (ky <= 5.1e-66) or not (ky <= 2.9e-52): tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.5e-141) tmp = Float64(ky / Float64(sin(kx) / th)); elseif ((ky <= 5.1e-66) || !(ky <= 2.9e-52)) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 9.5e-141) tmp = ky / (sin(kx) / th); elseif ((ky <= 5.1e-66) || ~((ky <= 2.9e-52))) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.5e-141], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 5.1e-66], N[Not[LessEqual[ky, 2.9e-52]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.5 \cdot 10^{-141}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{elif}\;ky \leq 5.1 \cdot 10^{-66} \lor \neg \left(ky \leq 2.9 \cdot 10^{-52}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if ky < 9.49999999999999996e-141Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/89.8%
associate-/l*91.9%
unpow291.9%
Simplified99.6%
associate-*r/94.3%
hypot-undefine89.8%
unpow289.8%
unpow289.8%
+-commutative89.8%
clear-num89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-undefine93.6%
Applied egg-rr93.6%
associate-/r/94.1%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
unpow289.6%
unpow289.6%
hypot-undefine94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in th around 0 40.2%
Taylor expanded in ky around 0 15.5%
associate-/l*18.1%
Simplified18.1%
clear-num18.1%
un-div-inv18.1%
Applied egg-rr18.1%
if 9.49999999999999996e-141 < ky < 5.10000000000000022e-66 or 2.9000000000000002e-52 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/96.7%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 30.6%
if 5.10000000000000022e-66 < ky < 2.9000000000000002e-52Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.3%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
associate-*r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
clear-num96.7%
+-commutative96.7%
unpow296.7%
unpow296.7%
hypot-undefine96.7%
Applied egg-rr96.7%
associate-/r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in th around 0 72.3%
Taylor expanded in ky around 0 70.5%
associate-/l*70.7%
Simplified70.7%
Final simplification24.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9.2e-141) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.2e-141) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 9.2d-141) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.2e-141) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.2e-141: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.2e-141) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 9.2e-141) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.2e-141], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.2 \cdot 10^{-141}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 9.1999999999999998e-141Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/89.8%
associate-/l*91.9%
unpow291.9%
Simplified99.6%
associate-*r/94.3%
hypot-undefine89.8%
unpow289.8%
unpow289.8%
+-commutative89.8%
clear-num89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-undefine93.6%
Applied egg-rr93.6%
associate-/r/94.1%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
unpow289.6%
unpow289.6%
hypot-undefine94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in th around 0 40.2%
Taylor expanded in ky around 0 15.5%
associate-/l*18.1%
Simplified18.1%
Taylor expanded in kx around 0 14.5%
associate-/l*17.1%
Simplified17.1%
if 9.1999999999999998e-141 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/96.9%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 29.0%
Final simplification21.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.8e-50) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.8e-50) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 7.8d-50) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.8e-50) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.8e-50: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.8e-50) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.8e-50) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.8e-50], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.8 \cdot 10^{-50}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 7.80000000000000042e-50Initial program 92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/89.8%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
associate-*r/93.9%
hypot-undefine89.8%
unpow289.8%
unpow289.8%
+-commutative89.8%
clear-num89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-undefine93.1%
Applied egg-rr93.1%
associate-/r/93.7%
hypot-undefine89.7%
unpow289.7%
unpow289.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-undefine93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in th around 0 42.2%
Taylor expanded in ky around 0 19.1%
associate-/l*21.9%
Simplified21.9%
Taylor expanded in kx around 0 15.6%
associate-/l*18.3%
Simplified18.3%
if 7.80000000000000042e-50 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 28.6%
Taylor expanded in th around 0 19.6%
Final simplification18.7%
(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 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/92.5%
associate-/l*94.9%
unpow294.9%
Simplified99.6%
Taylor expanded in kx around 0 19.3%
Taylor expanded in th around 0 12.3%
Final simplification12.3%
herbie shell --seed 2024053
(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)))