
(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 96.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.001)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin kx) 1e-38)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.001) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-38) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(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 (sin(kx) <= (-0.001d0)) then
tmp = abs((sin(ky) * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-38) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.001) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-38) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} 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.001: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-38: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) 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.001) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-38) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); 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.001) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-38) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.001], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-38], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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.001:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-38}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -1e-3Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 12.6%
add-sqr-sqrt9.8%
sqrt-unprod26.4%
pow226.4%
associate-/r/26.4%
*-commutative26.4%
Applied egg-rr26.4%
unpow226.4%
rem-sqrt-square45.1%
*-commutative45.1%
Simplified45.1%
if -1e-3 < (sin.f64 kx) < 9.9999999999999996e-39Initial program 91.4%
unpow291.4%
sqr-neg91.4%
sin-neg91.4%
sin-neg91.4%
unpow291.4%
associate-*l/90.6%
associate-/l*91.2%
+-commutative91.2%
unpow291.2%
sin-neg91.2%
sin-neg91.2%
Simplified99.7%
Taylor expanded in kx around 0 36.5%
add-sqr-sqrt34.9%
sqrt-prod77.9%
rem-sqrt-square82.3%
Applied egg-rr82.3%
if 9.9999999999999996e-39 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 61.0%
Final simplification66.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.001) (fabs (* (sin ky) (/ (sin th) (sin kx)))) (if (<= (sin kx) 5e-44) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.001) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-44) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(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 (sin(kx) <= (-0.001d0)) then
tmp = abs((sin(ky) * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-44) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.001) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-44) {
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.001: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-44: 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.001) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-44) 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.001) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-44) 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.001], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-44], 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.001:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -1e-3Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 12.6%
add-sqr-sqrt9.8%
sqrt-unprod26.4%
pow226.4%
associate-/r/26.4%
*-commutative26.4%
Applied egg-rr26.4%
unpow226.4%
rem-sqrt-square45.1%
*-commutative45.1%
Simplified45.1%
if -1e-3 < (sin.f64 kx) < 5.00000000000000039e-44Initial program 91.3%
unpow291.3%
sqr-neg91.3%
sin-neg91.3%
sin-neg91.3%
unpow291.3%
associate-*l/90.5%
associate-/l*91.1%
+-commutative91.1%
unpow291.1%
sin-neg91.1%
sin-neg91.1%
Simplified99.7%
Taylor expanded in kx around 0 36.1%
if 5.00000000000000039e-44 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 60.4%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 96.0%
unpow296.0%
sqr-neg96.0%
sin-neg96.0%
sin-neg96.0%
unpow296.0%
associate-*l/95.6%
associate-/l*95.9%
+-commutative95.9%
unpow295.9%
sin-neg95.9%
sin-neg95.9%
Simplified99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 6e-11)
(/ (sin ky) (/ (hypot ky (sin kx)) (sin th)))
(if (<= ky 5.5e+16)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = sin(ky) / (hypot(ky, sin(kx)) / sin(th));
} else if (ky <= 5.5e+16) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = Math.sin(ky) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
} else if (ky <= 5.5e+16) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-11: tmp = math.sin(ky) / (math.hypot(ky, math.sin(kx)) / math.sin(th)) elif ky <= 5.5e+16: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-11) tmp = Float64(sin(ky) / Float64(hypot(ky, sin(kx)) / sin(th))); elseif (ky <= 5.5e+16) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-11) tmp = sin(ky) / (hypot(ky, sin(kx)) / sin(th)); elseif (ky <= 5.5e+16) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-11], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 5.5e+16], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-11}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{elif}\;ky \leq 5.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 6e-11Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/94.2%
associate-/l*94.6%
+-commutative94.6%
unpow294.6%
sin-neg94.6%
sin-neg94.6%
Simplified99.5%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 66.7%
if 6e-11 < ky < 5.5e16Initial program 100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 99.8%
if 5.5e16 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 24.1%
add-sqr-sqrt22.4%
sqrt-prod60.7%
rem-sqrt-square60.7%
Applied egg-rr60.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 6e-11)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(if (<= ky 5.7e+16)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else if (ky <= 5.7e+16) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 5.7e+16) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-11: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) elif ky <= 5.7e+16: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-11) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); elseif (ky <= 5.7e+16) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-11) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); elseif (ky <= 5.7e+16) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-11], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 5.7e+16], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-11}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 5.7 \cdot 10^{+16}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 6e-11Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/94.2%
associate-/l*94.6%
+-commutative94.6%
unpow294.6%
sin-neg94.6%
sin-neg94.6%
Simplified99.5%
Taylor expanded in ky around 0 66.6%
if 6e-11 < ky < 5.7e16Initial program 100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 99.8%
if 5.7e16 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 24.1%
add-sqr-sqrt22.4%
sqrt-prod60.7%
rem-sqrt-square60.7%
Applied egg-rr60.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 6e-11)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(if (<= ky 5.7e+16)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else if (ky <= 5.7e+16) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-11) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 5.7e+16) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-11: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) elif ky <= 5.7e+16: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-11) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); elseif (ky <= 5.7e+16) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-11) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); elseif (ky <= 5.7e+16) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-11], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 5.7e+16], 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[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-11}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 5.7 \cdot 10^{+16}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 6e-11Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/94.2%
associate-/l*94.6%
+-commutative94.6%
unpow294.6%
sin-neg94.6%
sin-neg94.6%
Simplified99.5%
Taylor expanded in ky around 0 66.6%
if 6e-11 < ky < 5.7e16Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.1%
Taylor expanded in th around 0 99.1%
if 5.7e16 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 24.1%
add-sqr-sqrt22.4%
sqrt-prod60.7%
rem-sqrt-square60.7%
Applied egg-rr60.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.021)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 7.5e+262)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin th) (/ (fabs (sin kx)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.021) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 7.5e+262) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) / (fabs(sin(kx)) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.021) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 7.5e+262) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) / (Math.abs(Math.sin(kx)) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.021: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 7.5e+262: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) / (math.fabs(math.sin(kx)) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.021) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 7.5e+262) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) / Float64(abs(sin(kx)) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.021) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 7.5e+262) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) / (abs(sin(kx)) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.021], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 7.5e+262], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.021:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 7.5 \cdot 10^{+262}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\left|\sin kx\right|}{\sin ky}}\\
\end{array}
\end{array}
if th < 0.0210000000000000013Initial program 96.4%
unpow296.4%
sqr-neg96.4%
sin-neg96.4%
sin-neg96.4%
unpow296.4%
associate-*l/95.9%
associate-/l*96.2%
+-commutative96.2%
unpow296.2%
sin-neg96.2%
sin-neg96.2%
Simplified99.5%
Taylor expanded in th around 0 64.2%
if 0.0210000000000000013 < th < 7.49999999999999977e262Initial program 94.1%
unpow294.1%
sqr-neg94.1%
sin-neg94.1%
sin-neg94.1%
unpow294.1%
associate-*l/94.0%
associate-/l*94.0%
+-commutative94.0%
unpow294.0%
sin-neg94.0%
sin-neg94.0%
Simplified99.6%
Taylor expanded in kx around 0 22.5%
add-sqr-sqrt21.8%
sqrt-prod38.9%
rem-sqrt-square41.0%
Applied egg-rr41.0%
if 7.49999999999999977e262 < th Initial program 98.7%
unpow298.7%
sqr-neg98.7%
sin-neg98.7%
sin-neg98.7%
unpow298.7%
associate-*l/98.7%
associate-/l*99.1%
+-commutative99.1%
unpow299.1%
sin-neg99.1%
sin-neg99.1%
Simplified99.1%
associate-*r/98.9%
hypot-undefine98.7%
unpow298.7%
unpow298.7%
+-commutative98.7%
associate-*l/98.7%
*-commutative98.7%
clear-num98.4%
un-div-inv98.9%
+-commutative98.9%
unpow298.9%
unpow298.9%
hypot-undefine98.9%
Applied egg-rr98.9%
Taylor expanded in ky around 0 27.1%
add-sqr-sqrt25.9%
sqrt-unprod54.2%
pow254.2%
Applied egg-rr54.2%
unpow254.2%
rem-sqrt-square54.2%
Simplified54.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 4e-126) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-126) {
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.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-126) 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.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-126) {
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.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-126: 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-126) 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-126) 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.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-126], 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.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-126}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.2%
sqrt-unprod30.3%
pow230.3%
Applied egg-rr30.3%
unpow230.3%
rem-sqrt-square39.4%
associate-*r/39.4%
associate-*l/39.5%
*-inverses39.5%
*-lft-identity39.5%
Simplified39.5%
if -0.0050000000000000001 < (sin.f64 ky) < 3.9999999999999998e-126Initial program 90.2%
Taylor expanded in ky around 0 53.5%
if 3.9999999999999998e-126 < (sin.f64 ky) Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/98.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 52.5%
Final simplification49.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 4e-126) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-126) {
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.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-126) 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.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-126) {
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.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-126: 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-126) 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-126) 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.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-126], 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.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-126}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.2%
sqrt-unprod30.3%
pow230.3%
Applied egg-rr30.3%
unpow230.3%
rem-sqrt-square39.4%
associate-*r/39.4%
associate-*l/39.5%
*-inverses39.5%
*-lft-identity39.5%
Simplified39.5%
if -0.0050000000000000001 < (sin.f64 ky) < 3.9999999999999998e-126Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/90.0%
associate-/l*90.1%
+-commutative90.1%
unpow290.1%
sin-neg90.1%
sin-neg90.1%
Simplified99.5%
Taylor expanded in ky around 0 52.4%
associate-/l*53.4%
Simplified53.4%
if 3.9999999999999998e-126 < (sin.f64 ky) Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/98.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 52.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.1e-36) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (/ (sin th) (/ (fabs (sin kx)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-36) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) / (fabs(sin(kx)) / sin(ky));
}
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 <= 3.1d-36) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) / (abs(sin(kx)) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-36) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) / (Math.abs(Math.sin(kx)) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.1e-36: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) / (math.fabs(math.sin(kx)) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.1e-36) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) / Float64(abs(sin(kx)) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.1e-36) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) / (abs(sin(kx)) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.1e-36], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.1 \cdot 10^{-36}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\left|\sin kx\right|}{\sin ky}}\\
\end{array}
\end{array}
if kx < 3.0999999999999999e-36Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/94.1%
associate-/l*94.5%
+-commutative94.5%
unpow294.5%
sin-neg94.5%
sin-neg94.5%
Simplified99.6%
Taylor expanded in kx around 0 26.0%
add-sqr-sqrt24.2%
sqrt-prod52.1%
rem-sqrt-square55.1%
Applied egg-rr55.1%
if 3.0999999999999999e-36 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.3%
associate-*r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
associate-*l/99.4%
*-commutative99.4%
clear-num99.2%
un-div-inv99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 42.7%
add-sqr-sqrt35.4%
sqrt-unprod63.9%
pow263.9%
Applied egg-rr63.9%
unpow263.9%
rem-sqrt-square63.9%
Simplified63.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.4e-44) (sin th) (* (sin th) (/ (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.4e-44) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(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 <= 3.4d-44) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.4e-44) {
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 kx <= 3.4e-44: 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 (kx <= 3.4e-44) 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 (kx <= 3.4e-44) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.4e-44], 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}\;kx \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.40000000000000016e-44Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/94.1%
associate-/l*94.5%
+-commutative94.5%
unpow294.5%
sin-neg94.5%
sin-neg94.5%
Simplified99.6%
Taylor expanded in kx around 0 25.7%
if 3.40000000000000016e-44 < kx Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 42.4%
Final simplification30.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.3e-44) (sin th) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.3e-44) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(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 <= 4.3d-44) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.3e-44) {
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 kx <= 4.3e-44: 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 (kx <= 4.3e-44) 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 (kx <= 4.3e-44) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.3e-44], 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}\;kx \leq 4.3 \cdot 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 4.30000000000000013e-44Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/94.1%
associate-/l*94.5%
+-commutative94.5%
unpow294.5%
sin-neg94.5%
sin-neg94.5%
Simplified99.6%
Taylor expanded in kx around 0 25.7%
if 4.30000000000000013e-44 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.3%
Taylor expanded in ky around 0 42.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.3e-163) 0.0 (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.3e-163) {
tmp = 0.0;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.3d-163) then
tmp = 0.0d0
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.3e-163) {
tmp = 0.0;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.3e-163: tmp = 0.0 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.3e-163) tmp = 0.0; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.3e-163) tmp = 0.0; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.3e-163], 0.0, N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.3 \cdot 10^{-163}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.30000000000000001e-163Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/93.7%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.5%
Taylor expanded in kx around 0 14.8%
add-log-exp23.1%
Applied egg-rr23.1%
Taylor expanded in th around 0 17.5%
metadata-eval17.5%
Applied egg-rr17.5%
if 3.30000000000000001e-163 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/98.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 31.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1e-55) th 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1e-55) {
tmp = 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 (kx <= 1d-55) then
tmp = th
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1e-55) {
tmp = th;
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1e-55: tmp = th else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1e-55) tmp = th; else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1e-55) tmp = th; else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1e-55], th, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 10^{-55}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 9.99999999999999995e-56Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/94.0%
associate-/l*94.4%
+-commutative94.4%
unpow294.4%
sin-neg94.4%
sin-neg94.4%
Simplified99.6%
Taylor expanded in kx around 0 25.5%
Taylor expanded in th around 0 13.3%
if 9.99999999999999995e-56 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.3%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.3%
Taylor expanded in kx around 0 10.5%
add-log-exp19.2%
Applied egg-rr19.2%
Taylor expanded in th around 0 14.3%
metadata-eval14.3%
Applied egg-rr14.3%
(FPCore (kx ky th) :precision binary64 0.0)
double code(double kx, double ky, double th) {
return 0.0;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 0.0d0
end function
public static double code(double kx, double ky, double th) {
return 0.0;
}
def code(kx, ky, th): return 0.0
function code(kx, ky, th) return 0.0 end
function tmp = code(kx, ky, th) tmp = 0.0; end
code[kx_, ky_, th_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 96.0%
unpow296.0%
sqr-neg96.0%
sin-neg96.0%
sin-neg96.0%
unpow296.0%
associate-*l/95.6%
associate-/l*95.9%
+-commutative95.9%
unpow295.9%
sin-neg95.9%
sin-neg95.9%
Simplified99.5%
Taylor expanded in kx around 0 21.1%
add-log-exp22.6%
Applied egg-rr22.6%
Taylor expanded in th around 0 12.8%
metadata-eval12.8%
Applied egg-rr12.8%
herbie shell --seed 2024139
(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)))