
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.0%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
associate-*r/96.0%
hypot-undefine92.0%
unpow292.0%
unpow292.0%
+-commutative92.0%
associate-*l/93.1%
*-commutative93.1%
clear-num93.1%
un-div-inv93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.506)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 2e-104)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 2e-44) (* ky (/ th (hypot ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.506) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-104) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 2e-44) {
tmp = ky * (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.506) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-104) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-44) {
tmp = ky * (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.506: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-104: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 2e-44: tmp = ky * (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.506) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-104) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 2e-44) tmp = Float64(ky * Float64(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.506) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-104) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 2e-44) tmp = ky * (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.506], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-104], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-44], N[(ky * N[(th / 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.506:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-104}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\
\;\;\;\;ky \cdot \frac{th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.50600000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
if -0.50600000000000001 < (sin.f64 ky) < 1.99999999999999985e-104Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/84.3%
associate-/l*86.6%
unpow286.6%
Simplified99.6%
Taylor expanded in ky around 0 42.0%
if 1.99999999999999985e-104 < (sin.f64 ky) < 1.99999999999999991e-44Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 99.4%
Taylor expanded in th around 0 65.2%
Taylor expanded in ky around 0 65.2%
if 1.99999999999999991e-44 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 64.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 2e-104)
(/ (sin th) (/ (sin kx) ky))
(if (<= (sin ky) 2e-44) (* ky (/ th (hypot ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-104) {
tmp = sin(th) / (sin(kx) / ky);
} else if (sin(ky) <= 2e-44) {
tmp = ky * (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.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-104) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(ky) <= 2e-44) {
tmp = ky * (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.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-104: tmp = math.sin(th) / (math.sin(kx) / ky) elif math.sin(ky) <= 2e-44: tmp = ky * (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 = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-104) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (sin(ky) <= 2e-44) tmp = Float64(ky * Float64(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 = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-104) tmp = sin(th) / (sin(kx) / ky); elseif (sin(ky) <= 2e-44) tmp = ky * (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[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-104], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-44], N[(ky * N[(th / 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:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\
\;\;\;\;ky \cdot \frac{th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.2%
sqrt-unprod21.6%
pow221.6%
Applied egg-rr21.6%
if -0.0200000000000000004 < (sin.f64 ky) < 1.99999999999999985e-104Initial program 83.3%
unpow283.3%
sqr-neg83.3%
sin-neg83.3%
sin-neg83.3%
unpow283.3%
associate-*l/80.3%
associate-/l*83.3%
unpow283.3%
Simplified99.7%
associate-*r/90.4%
hypot-undefine80.3%
unpow280.3%
unpow280.3%
+-commutative80.3%
associate-*l/83.3%
*-commutative83.3%
clear-num83.3%
un-div-inv83.4%
+-commutative83.4%
unpow283.4%
unpow283.4%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 50.6%
if 1.99999999999999985e-104 < (sin.f64 ky) < 1.99999999999999991e-44Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 99.4%
Taylor expanded in th around 0 65.2%
Taylor expanded in ky around 0 65.2%
if 1.99999999999999991e-44 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 64.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 2e-104)
(/ (sin th) (/ (sin kx) ky))
(if (<= (sin ky) 2e-44) (* ky (/ 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) <= 2e-104) {
tmp = sin(th) / (sin(kx) / ky);
} else if (sin(ky) <= 2e-44) {
tmp = ky * (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) <= 2e-104) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(ky) <= 2e-44) {
tmp = ky * (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) <= 2e-104: tmp = math.sin(th) / (math.sin(kx) / ky) elif math.sin(ky) <= 2e-44: tmp = ky * (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) <= 2e-104) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (sin(ky) <= 2e-44) tmp = Float64(ky * Float64(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) <= 2e-104) tmp = sin(th) / (sin(kx) / ky); elseif (sin(ky) <= 2e-44) tmp = ky * (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], 2e-104], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-44], N[(ky * N[(th / 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 2 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\
\;\;\;\;ky \cdot \frac{th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-exp-log1.2%
Applied egg-rr1.2%
rem-exp-log2.5%
add-sqr-sqrt1.2%
sqrt-unprod21.6%
pow221.6%
Applied egg-rr21.6%
unpow221.6%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 1.99999999999999985e-104Initial program 83.3%
unpow283.3%
sqr-neg83.3%
sin-neg83.3%
sin-neg83.3%
unpow283.3%
associate-*l/80.3%
associate-/l*83.3%
unpow283.3%
Simplified99.7%
associate-*r/90.4%
hypot-undefine80.3%
unpow280.3%
unpow280.3%
+-commutative80.3%
associate-*l/83.3%
*-commutative83.3%
clear-num83.3%
un-div-inv83.4%
+-commutative83.4%
unpow283.4%
unpow283.4%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 50.6%
if 1.99999999999999985e-104 < (sin.f64 ky) < 1.99999999999999991e-44Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 99.4%
Taylor expanded in th around 0 65.2%
Taylor expanded in ky around 0 65.2%
if 1.99999999999999991e-44 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 64.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.1)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 2.5e-16)
(* ky (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.1) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2.5e-16) {
tmp = 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.1) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2.5e-16) {
tmp = 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.1: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2.5e-16: tmp = 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.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2.5e-16) tmp = Float64(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.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2.5e-16) tmp = 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.1], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2.5e-16], N[(ky * 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.1:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2.5 \cdot 10^{-16}:\\
\;\;\;\;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.10000000000000001Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.2%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
if -0.10000000000000001 < (sin.f64 ky) < 2.5000000000000002e-16Initial program 86.4%
unpow286.4%
sqr-neg86.4%
sin-neg86.4%
sin-neg86.4%
unpow286.4%
associate-*l/84.1%
associate-/l*86.4%
unpow286.4%
Simplified99.7%
Taylor expanded in ky around 0 97.4%
Taylor expanded in ky around 0 98.1%
if 2.5000000000000002e-16 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 66.2%
(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(sin(ky) / Float64(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[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th}}
\end{array}
Initial program 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.0%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
(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 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.0%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 2.5e-16) (/ (sin th) (/ (sin kx) ky)) (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) <= 2.5e-16) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2.5d-16) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2.5e-16) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} 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) <= 2.5e-16: tmp = math.sin(th) / (math.sin(kx) / ky) 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) <= 2.5e-16) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2.5e-16) tmp = sin(th) / (sin(kx) / ky); 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], 2.5e-16], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2.5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-exp-log1.2%
Applied egg-rr1.2%
rem-exp-log2.5%
add-sqr-sqrt1.2%
sqrt-unprod21.6%
pow221.6%
Applied egg-rr21.6%
unpow221.6%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 2.5000000000000002e-16Initial program 86.1%
unpow286.1%
sqr-neg86.1%
sin-neg86.1%
sin-neg86.1%
unpow286.1%
associate-*l/83.7%
associate-/l*86.1%
unpow286.1%
Simplified99.6%
associate-*r/92.0%
hypot-undefine83.7%
unpow283.7%
unpow283.7%
+-commutative83.7%
associate-*l/86.1%
*-commutative86.1%
clear-num86.1%
un-div-inv86.2%
+-commutative86.2%
unpow286.2%
unpow286.2%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 46.6%
if 2.5000000000000002e-16 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 66.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 2.5e-16) (* (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) <= 2.5e-16) {
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) <= 2.5d-16) 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) <= 2.5e-16) {
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) <= 2.5e-16: 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) <= 2.5e-16) 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) <= 2.5e-16) 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], 2.5e-16], 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 2.5 \cdot 10^{-16}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-exp-log1.2%
Applied egg-rr1.2%
rem-exp-log2.5%
add-sqr-sqrt1.2%
sqrt-unprod21.6%
pow221.6%
Applied egg-rr21.6%
unpow221.6%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 2.5000000000000002e-16Initial program 86.1%
Taylor expanded in ky around 0 46.5%
if 2.5000000000000002e-16 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 66.2%
Final simplification46.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 2.5e-16) (* 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) <= 2.5e-16) {
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) <= 2.5d-16) 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) <= 2.5e-16) {
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) <= 2.5e-16: 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) <= 2.5e-16) 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) <= 2.5e-16) 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], 2.5e-16], 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 2.5 \cdot 10^{-16}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-exp-log1.2%
Applied egg-rr1.2%
rem-exp-log2.5%
add-sqr-sqrt1.2%
sqrt-unprod21.6%
pow221.6%
Applied egg-rr21.6%
unpow221.6%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 2.5000000000000002e-16Initial program 86.1%
unpow286.1%
sqr-neg86.1%
sin-neg86.1%
sin-neg86.1%
unpow286.1%
associate-*l/83.7%
associate-/l*86.1%
unpow286.1%
Simplified99.6%
Taylor expanded in ky around 0 45.9%
associate-/l*46.5%
Simplified46.5%
if 2.5000000000000002e-16 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 66.2%
(FPCore (kx ky th) :precision binary64 (if (<= th 7e-5) (/ th (/ (hypot (sin ky) (sin kx)) (sin ky))) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 7e-5) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 7e-5) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 7e-5: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 7e-5) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 7e-5) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 7e-5], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 6.9999999999999994e-5Initial program 91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
associate-*l/90.2%
associate-/l*91.7%
unpow291.7%
Simplified99.6%
associate-*r/94.9%
hypot-undefine90.2%
unpow290.2%
unpow290.2%
+-commutative90.2%
associate-*l/91.7%
*-commutative91.7%
clear-num91.7%
un-div-inv91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 68.3%
if 6.9999999999999994e-5 < th Initial program 97.9%
unpow297.9%
sqr-neg97.9%
sin-neg97.9%
sin-neg97.9%
unpow297.9%
associate-*l/97.9%
associate-/l*98.0%
unpow298.0%
Simplified99.6%
associate-*r/99.6%
hypot-undefine97.9%
unpow297.9%
unpow297.9%
+-commutative97.9%
associate-*l/97.9%
*-commutative97.9%
clear-num97.9%
un-div-inv97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 45.3%
Taylor expanded in ky around 0 55.2%
(FPCore (kx ky th) :precision binary64 (if (<= th 9e-5) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 9e-5) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 9e-5) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 9e-5: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 9e-5) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 9e-5) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 9e-5], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 9 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 9.00000000000000057e-5Initial program 91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
associate-*l/90.2%
associate-/l*91.7%
unpow291.7%
Simplified99.6%
Taylor expanded in th around 0 68.3%
if 9.00000000000000057e-5 < th Initial program 97.9%
unpow297.9%
sqr-neg97.9%
sin-neg97.9%
sin-neg97.9%
unpow297.9%
associate-*l/97.9%
associate-/l*98.0%
unpow298.0%
Simplified99.6%
associate-*r/99.6%
hypot-undefine97.9%
unpow297.9%
unpow297.9%
+-commutative97.9%
associate-*l/97.9%
*-commutative97.9%
clear-num97.9%
un-div-inv97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 45.3%
Taylor expanded in ky around 0 55.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.1) (sqrt (pow (sin th) 2.0)) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.1) {
tmp = sqrt(pow(sin(th), 2.0));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.1) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.1: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.1], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.1:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.10000000000000001Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.2%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
if -0.10000000000000001 < (sin.f64 ky) Initial program 91.1%
unpow291.1%
sqr-neg91.1%
sin-neg91.1%
sin-neg91.1%
unpow291.1%
associate-*l/89.5%
associate-/l*91.1%
unpow291.1%
Simplified99.7%
associate-*r/94.8%
hypot-undefine89.5%
unpow289.5%
unpow289.5%
+-commutative89.5%
associate-*l/91.1%
*-commutative91.1%
clear-num91.1%
un-div-inv91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 64.6%
Taylor expanded in ky around 0 73.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-307) (fabs (sin th)) (if (<= (sin ky) 2e-44) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-307) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-44) {
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 (sin(ky) <= 5d-307) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-44) 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 (Math.sin(ky) <= 5e-307) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-44) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-307: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-44: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-307) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-44) 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 (sin(ky) <= 5e-307) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-44) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-307], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-44], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-307}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 5.00000000000000014e-307Initial program 94.0%
unpow294.0%
sqr-neg94.0%
sin-neg94.0%
sin-neg94.0%
unpow294.0%
associate-*l/92.6%
associate-/l*94.0%
unpow294.0%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-exp-log1.4%
Applied egg-rr1.4%
rem-exp-log2.8%
add-sqr-sqrt1.4%
sqrt-unprod19.8%
pow219.8%
Applied egg-rr19.8%
unpow219.8%
rem-sqrt-square20.5%
Simplified20.5%
if 5.00000000000000014e-307 < (sin.f64 ky) < 1.99999999999999991e-44Initial program 82.4%
unpow282.4%
sqr-neg82.4%
sin-neg82.4%
sin-neg82.4%
unpow282.4%
associate-*l/80.5%
associate-/l*82.3%
unpow282.3%
Simplified99.7%
Taylor expanded in ky around 0 46.8%
Taylor expanded in th around 0 25.5%
Taylor expanded in ky around 0 25.5%
associate-/l*27.0%
Simplified27.0%
if 1.99999999999999991e-44 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 64.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.6e-84) (sin th) (/ (* th ky) (sin kx))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.6e-84) {
tmp = sin(th);
} else {
tmp = (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.6d-84) then
tmp = sin(th)
else
tmp = (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.6e-84) {
tmp = Math.sin(th);
} else {
tmp = (th * ky) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.6e-84: tmp = math.sin(th) else: tmp = (th * ky) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.6e-84) tmp = sin(th); else tmp = Float64(Float64(th * ky) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.6e-84) tmp = sin(th); else tmp = (th * ky) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.6e-84], N[Sin[th], $MachinePrecision], N[(N[(th * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.6 \cdot 10^{-84}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{th \cdot ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.6e-84Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/88.9%
associate-/l*90.5%
unpow290.5%
Simplified99.6%
Taylor expanded in kx around 0 28.8%
if 1.6e-84 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in ky around 0 34.1%
Taylor expanded in th around 0 21.5%
Taylor expanded in ky around 0 20.1%
*-commutative20.1%
Simplified20.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.75e-84) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.75e-84) {
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 (kx <= 1.75d-84) 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 (kx <= 1.75e-84) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.75e-84: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.75e-84) 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 (kx <= 1.75e-84) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.75e-84], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.75 \cdot 10^{-84}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.7500000000000001e-84Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/88.9%
associate-/l*90.5%
unpow290.5%
Simplified99.6%
Taylor expanded in kx around 0 28.8%
if 1.7500000000000001e-84 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in ky around 0 34.1%
Taylor expanded in th around 0 21.5%
Taylor expanded in ky around 0 20.1%
associate-/l*20.1%
Simplified20.1%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.0%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
(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 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.0%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 15.8%
herbie shell --seed 2024136
(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)))