
(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 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-307) (/ (sin ky) (/ (hypot (sin ky) kx) th)) (if (<= (sin ky) 1e-62) (* (sin th) (pow (/ (sin kx) ky) -1.0)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-307) {
tmp = sin(ky) / (hypot(sin(ky), kx) / th);
} else if (sin(ky) <= 1e-62) {
tmp = sin(th) * pow((sin(kx) / ky), -1.0);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-307) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / th);
} else if (Math.sin(ky) <= 1e-62) {
tmp = Math.sin(th) * Math.pow((Math.sin(kx) / ky), -1.0);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-307: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / th) elif math.sin(ky) <= 1e-62: tmp = math.sin(th) * math.pow((math.sin(kx) / ky), -1.0) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-307) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / th)); elseif (sin(ky) <= 1e-62) tmp = Float64(sin(th) * (Float64(sin(kx) / ky) ^ -1.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-307) tmp = sin(ky) / (hypot(sin(ky), kx) / th); elseif (sin(ky) <= 1e-62) tmp = sin(th) * ((sin(kx) / ky) ^ -1.0); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-307], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], N[(N[Sin[th], $MachinePrecision] * N[Power[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-307}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;\sin th \cdot {\left(\frac{\sin kx}{ky}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999909e-308Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/92.0%
associate-/l*93.5%
+-commutative93.5%
unpow293.5%
sin-neg93.5%
sin-neg93.5%
Simplified99.7%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 49.1%
Taylor expanded in kx around 0 36.5%
if 9.99999999999999909e-308 < (sin.f64 ky) < 1e-62Initial program 86.1%
clear-num86.1%
inv-pow86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 52.2%
if 1e-62 < (sin.f64 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 57.7%
Final simplification45.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.12) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-62) (* (sin th) (pow (/ (sin kx) ky) -1.0)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.12) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-62) {
tmp = sin(th) * pow((sin(kx) / ky), -1.0);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.12d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-62) then
tmp = sin(th) * ((sin(kx) / ky) ** (-1.0d0))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.12) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-62) {
tmp = Math.sin(th) * Math.pow((Math.sin(kx) / ky), -1.0);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.12: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-62: tmp = math.sin(th) * math.pow((math.sin(kx) / ky), -1.0) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.12) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-62) tmp = Float64(sin(th) * (Float64(sin(kx) / ky) ^ -1.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.12) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-62) tmp = sin(th) * ((sin(kx) / ky) ^ -1.0); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.12], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], N[(N[Sin[th], $MachinePrecision] * N[Power[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.12:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;\sin th \cdot {\left(\frac{\sin kx}{ky}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.5%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.7%
pow231.7%
Applied egg-rr31.7%
if -0.12 < (sin.f64 ky) < 1e-62Initial program 87.8%
clear-num87.7%
inv-pow87.7%
+-commutative87.7%
unpow287.7%
unpow287.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.9%
if 1e-62 < (sin.f64 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 57.7%
Final simplification46.7%
(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.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.0%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0018)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 2.15e+198)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin ky) (/ (fabs (sin kx)) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0018) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 2.15e+198) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(ky) / (fabs(sin(kx)) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0018) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 2.15e+198) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(ky) / (Math.abs(Math.sin(kx)) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0018: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 2.15e+198: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(ky) / (math.fabs(math.sin(kx)) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0018) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 2.15e+198) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(ky) / Float64(abs(sin(kx)) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0018) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 2.15e+198) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(ky) / (abs(sin(kx)) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0018], 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, 2.15e+198], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0018:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 2.15 \cdot 10^{+198}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\left|\sin kx\right|}{\sin th}}\\
\end{array}
\end{array}
if th < 0.0018Initial program 94.1%
unpow294.1%
sqr-neg94.1%
sin-neg94.1%
sin-neg94.1%
unpow294.1%
associate-*l/93.0%
associate-/l*93.9%
+-commutative93.9%
unpow293.9%
sin-neg93.9%
sin-neg93.9%
Simplified99.6%
Taylor expanded in th around 0 67.6%
if 0.0018 < th < 2.14999999999999991e198Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.8%
+-commutative99.8%
unpow299.8%
sin-neg99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in kx around 0 29.9%
add-sqr-sqrt28.7%
sqrt-prod46.4%
rem-sqrt-square46.8%
Applied egg-rr46.8%
if 2.14999999999999991e198 < th Initial program 84.3%
unpow284.3%
sqr-neg84.3%
sin-neg84.3%
sin-neg84.3%
unpow284.3%
associate-*l/84.2%
associate-/l*84.2%
+-commutative84.2%
unpow284.2%
sin-neg84.2%
sin-neg84.2%
Simplified99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 20.7%
add-sqr-sqrt19.2%
sqrt-unprod40.4%
pow240.4%
Applied egg-rr40.4%
unpow240.4%
rem-sqrt-square51.5%
Simplified51.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.12) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-62) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.12) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-62) {
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.12d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-62) 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.12) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-62) {
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.12: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-62: 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.12) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-62) 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.12) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-62) 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.12], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], 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.12:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.5%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.7%
pow231.7%
Applied egg-rr31.7%
if -0.12 < (sin.f64 ky) < 1e-62Initial program 87.8%
unpow287.8%
sqr-neg87.8%
sin-neg87.8%
sin-neg87.8%
unpow287.8%
associate-*l/86.2%
associate-/l*87.7%
+-commutative87.7%
unpow287.7%
sin-neg87.7%
sin-neg87.7%
Simplified99.7%
Taylor expanded in ky around 0 44.8%
associate-/l*46.9%
Simplified46.9%
if 1e-62 < (sin.f64 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 57.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.12) (fabs (sin th)) (if (<= (sin ky) 1e-62) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.12) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-62) {
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.12d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-62) 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.12) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-62) {
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.12: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-62: 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.12) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) 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.12) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) 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.12], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], 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.12:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.5%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.2%
sqrt-unprod31.7%
pow231.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square38.6%
associate-*r/38.7%
*-rgt-identity38.7%
times-frac38.8%
*-inverses38.8%
/-rgt-identity38.8%
*-lft-identity38.8%
Simplified38.8%
if -0.12 < (sin.f64 ky) < 1e-62Initial program 87.8%
unpow287.8%
sqr-neg87.8%
sin-neg87.8%
sin-neg87.8%
unpow287.8%
associate-*l/86.2%
associate-/l*87.7%
+-commutative87.7%
unpow287.7%
sin-neg87.7%
sin-neg87.7%
Simplified99.7%
Taylor expanded in ky around 0 44.8%
associate-/l*46.9%
Simplified46.9%
if 1e-62 < (sin.f64 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 57.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-7) (* (sin th) (/ (sin ky) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-7) {
tmp = sin(th) * (sin(ky) / hypot(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 <= 8e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(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 <= 8e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(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 <= 8e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(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 <= 8e-7) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 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 8 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 7.9999999999999996e-7Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 69.2%
if 7.9999999999999996e-7 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.3%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 27.5%
add-sqr-sqrt25.9%
sqrt-prod52.7%
rem-sqrt-square52.7%
Applied egg-rr52.7%
Final simplification65.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-7) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-7) {
tmp = sin(ky) * (sin(th) / hypot(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 <= 8e-7) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(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 <= 8e-7: tmp = math.sin(ky) * (math.sin(th) / math.hypot(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 <= 8e-7) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(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 <= 8e-7) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 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 8 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 7.9999999999999996e-7Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*91.9%
+-commutative91.9%
unpow291.9%
sin-neg91.9%
sin-neg91.9%
Simplified99.7%
Taylor expanded in ky around 0 69.1%
if 7.9999999999999996e-7 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.3%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 27.5%
add-sqr-sqrt25.9%
sqrt-prod52.7%
rem-sqrt-square52.7%
Applied egg-rr52.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.6e-56) (/ (sin ky) (/ (fabs (sin kx)) (sin th))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.6e-56) {
tmp = sin(ky) / (fabs(sin(kx)) / sin(th));
} else {
tmp = sin(ky) * (sin(th) / fabs(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 (ky <= 4.6d-56) then
tmp = sin(ky) / (abs(sin(kx)) / sin(th))
else
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.6e-56) {
tmp = Math.sin(ky) / (Math.abs(Math.sin(kx)) / Math.sin(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 <= 4.6e-56: tmp = math.sin(ky) / (math.fabs(math.sin(kx)) / math.sin(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 <= 4.6e-56) tmp = Float64(sin(ky) / Float64(abs(sin(kx)) / sin(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 <= 4.6e-56) tmp = sin(ky) / (abs(sin(kx)) / sin(th)); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.6e-56], N[(N[Sin[ky], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[th], $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 4.6 \cdot 10^{-56}:\\
\;\;\;\;\frac{\sin ky}{\frac{\left|\sin kx\right|}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 4.60000000000000005e-56Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/90.5%
associate-/l*91.5%
+-commutative91.5%
unpow291.5%
sin-neg91.5%
sin-neg91.5%
Simplified99.7%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 34.2%
add-sqr-sqrt25.4%
sqrt-unprod50.7%
pow250.7%
Applied egg-rr50.7%
unpow250.7%
rem-sqrt-square54.9%
Simplified54.9%
if 4.60000000000000005e-56 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 32.7%
add-sqr-sqrt31.3%
sqrt-prod54.8%
rem-sqrt-square54.8%
Applied egg-rr54.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.05e-59) (* (sin th) (pow (/ (sin kx) ky) -1.0)) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.05e-59) {
tmp = sin(th) * pow((sin(kx) / ky), -1.0);
} else {
tmp = sin(ky) * (sin(th) / fabs(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 (ky <= 1.05d-59) then
tmp = sin(th) * ((sin(kx) / ky) ** (-1.0d0))
else
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.05e-59) {
tmp = Math.sin(th) * Math.pow((Math.sin(kx) / ky), -1.0);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.05e-59: tmp = math.sin(th) * math.pow((math.sin(kx) / ky), -1.0) 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 <= 1.05e-59) tmp = Float64(sin(th) * (Float64(sin(kx) / ky) ^ -1.0)); 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 <= 1.05e-59) tmp = sin(th) * ((sin(kx) / ky) ^ -1.0); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.05e-59], N[(N[Sin[th], $MachinePrecision] * N[Power[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision], -1.0], $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 1.05 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot {\left(\frac{\sin kx}{ky}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 1.04999999999999998e-59Initial program 91.6%
clear-num91.5%
inv-pow91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 33.0%
if 1.04999999999999998e-59 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 32.7%
add-sqr-sqrt31.3%
sqrt-prod54.8%
rem-sqrt-square54.8%
Applied egg-rr54.8%
Final simplification39.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.1e-99) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.1e-99) {
tmp = ky * (sin(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 <= 2.1d-99) then
tmp = ky * (sin(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 <= 2.1e-99) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.1e-99: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.1e-99) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.1e-99) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.1e-99], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.1 \cdot 10^{-99}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.09999999999999984e-99Initial program 91.4%
clear-num91.3%
inv-pow91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 33.1%
Taylor expanded in kx around 0 24.4%
associate-/l*25.8%
Simplified25.8%
if 2.09999999999999984e-99 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 33.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.5e-207) (* th (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.5e-207) {
tmp = th * (ky / 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 <= 7.5d-207) then
tmp = th * (ky / 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 <= 7.5e-207) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.5e-207: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.5e-207) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.5e-207) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.5e-207], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.5 \cdot 10^{-207}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.5000000000000006e-207Initial program 92.6%
clear-num92.5%
inv-pow92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 31.6%
Taylor expanded in th around 0 21.3%
Taylor expanded in kx around 0 20.2%
if 7.5000000000000006e-207 < ky Initial program 95.9%
unpow295.9%
sqr-neg95.9%
sin-neg95.9%
sin-neg95.9%
unpow295.9%
associate-*l/95.7%
associate-/l*95.6%
+-commutative95.6%
unpow295.6%
sin-neg95.6%
sin-neg95.6%
Simplified99.4%
Taylor expanded in kx around 0 34.3%
Final simplification25.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.6e-111) (* th (/ ky kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.6e-111) {
tmp = th * (ky / 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 <= 6.6d-111) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.6e-111) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.6e-111: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.6e-111) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6.6e-111) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.6e-111], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.6 \cdot 10^{-111}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 6.6e-111Initial program 91.3%
clear-num91.3%
inv-pow91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 33.3%
Taylor expanded in th around 0 22.8%
Taylor expanded in kx around 0 20.8%
if 6.6e-111 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 33.4%
Taylor expanded in th around 0 20.3%
Final simplification20.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.6e-110) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-110) {
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 <= 2.6d-110) 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 <= 2.6e-110) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.6e-110: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.6e-110) 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 <= 2.6e-110) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.6e-110], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.6 \cdot 10^{-110}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 2.5999999999999999e-110Initial program 91.3%
clear-num91.3%
inv-pow91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 33.3%
Taylor expanded in kx around 0 24.5%
associate-/l*26.0%
Simplified26.0%
Taylor expanded in th around 0 19.3%
associate-/l*20.7%
Simplified20.7%
if 2.5999999999999999e-110 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in kx around 0 33.4%
Taylor expanded in th around 0 20.3%
(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.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.0%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.6%
Taylor expanded in kx around 0 23.4%
Taylor expanded in th around 0 13.7%
herbie shell --seed 2024158
(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)))