
(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 17 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.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.03) (/ (sin ky) (* (/ 1.0 th) (hypot (sin ky) kx))) (if (<= (sin ky) 4e-7) (/ ky (/ (hypot ky (sin kx)) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.03) {
tmp = sin(ky) / ((1.0 / th) * hypot(sin(ky), kx));
} else if (sin(ky) <= 4e-7) {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.03) {
tmp = Math.sin(ky) / ((1.0 / th) * Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(ky) <= 4e-7) {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.03: tmp = math.sin(ky) / ((1.0 / th) * math.hypot(math.sin(ky), kx)) elif math.sin(ky) <= 4e-7: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.03) tmp = Float64(sin(ky) / Float64(Float64(1.0 / th) * hypot(sin(ky), kx))); elseif (sin(ky) <= 4e-7) tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.03) tmp = sin(ky) / ((1.0 / th) * hypot(sin(ky), kx)); elseif (sin(ky) <= 4e-7) tmp = ky / (hypot(ky, sin(kx)) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.03], N[(N[Sin[ky], $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] * N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-7], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.03:\\
\;\;\;\;\frac{\sin ky}{\frac{1}{th} \cdot \mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.029999999999999999Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
clear-num99.2%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 47.5%
+-commutative47.5%
unpow247.5%
unpow247.5%
hypot-undefine47.5%
Simplified47.5%
Taylor expanded in kx around 0 23.1%
if -0.029999999999999999 < (sin.f64 ky) < 3.9999999999999998e-7Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/81.0%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
Taylor expanded in ky around 0 99.5%
if 3.9999999999999998e-7 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 60.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 4e-7) (/ ky (/ (hypot ky (sin kx)) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-7) {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-7) {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-7: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-7) tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-7) tmp = ky / (hypot(ky, sin(kx)) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-7], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.1%
associate-*r/35.1%
*-rgt-identity35.1%
times-frac35.1%
*-inverses35.1%
/-rgt-identity35.1%
*-lft-identity35.1%
Simplified35.1%
if -0.0200000000000000004 < (sin.f64 ky) < 3.9999999999999998e-7Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/81.0%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
Taylor expanded in ky around 0 99.5%
if 3.9999999999999998e-7 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 60.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-40) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-40) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-40) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-40) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-40: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-40) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-40) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-40], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-40}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.1%
associate-*r/35.1%
*-rgt-identity35.1%
times-frac35.1%
*-inverses35.1%
/-rgt-identity35.1%
*-lft-identity35.1%
Simplified35.1%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999993e-41Initial program 86.3%
clear-num86.3%
inv-pow86.3%
+-commutative86.3%
unpow286.3%
unpow286.3%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 45.0%
add-sqr-sqrt21.7%
sqrt-unprod35.5%
pow235.5%
unpow-135.5%
clear-num35.5%
Applied egg-rr35.5%
unpow235.5%
rem-sqrt-square45.9%
Simplified45.9%
if 9.9999999999999993e-41 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 60.9%
Final simplification46.9%
(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.7%
unpow293.7%
sqr-neg93.7%
sin-neg93.7%
sin-neg93.7%
unpow293.7%
associate-*l/90.7%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (* ky (/ (sin th) (sin kx))))) (if (<= (sin kx) -0.02) (fabs t_1) (if (<= (sin kx) 2e-174) (sin th) t_1))))
double code(double kx, double ky, double th) {
double t_1 = ky * (sin(th) / sin(kx));
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs(t_1);
} else if (sin(kx) <= 2e-174) {
tmp = sin(th);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = ky * (sin(th) / sin(kx))
if (sin(kx) <= (-0.02d0)) then
tmp = abs(t_1)
else if (sin(kx) <= 2d-174) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky * (Math.sin(th) / Math.sin(kx));
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-174) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * (math.sin(th) / math.sin(kx)) tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs(t_1) elif math.sin(kx) <= 2e-174: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(ky * Float64(sin(th) / sin(kx))) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(t_1); elseif (sin(kx) <= 2e-174) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky * (sin(th) / sin(kx)); tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs(t_1); elseif (sin(kx) <= 2e-174) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-174], N[Sin[th], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-174}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
clear-num99.4%
inv-pow99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 12.8%
add-sqr-sqrt10.7%
sqrt-unprod19.8%
pow219.8%
*-commutative19.8%
unpow-119.8%
clear-num19.8%
Applied egg-rr19.8%
unpow219.8%
rem-sqrt-square28.7%
associate-*r/28.7%
*-commutative28.7%
associate-/l*28.7%
Simplified28.7%
if -0.0200000000000000004 < (sin.f64 kx) < 2e-174Initial program 84.7%
unpow284.7%
sqr-neg84.7%
sin-neg84.7%
sin-neg84.7%
unpow284.7%
associate-*l/78.6%
associate-/l*84.6%
+-commutative84.6%
unpow284.6%
sin-neg84.6%
sin-neg84.6%
Simplified99.8%
Taylor expanded in kx around 0 43.3%
if 2e-174 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/97.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in ky around 0 49.2%
associate-/l*51.1%
Simplified51.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-96) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-96) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-96) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-96) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-96: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-96) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-96) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-96], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-96}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.1%
associate-*r/35.1%
*-rgt-identity35.1%
times-frac35.1%
*-inverses35.1%
/-rgt-identity35.1%
*-lft-identity35.1%
Simplified35.1%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999991e-97Initial program 84.9%
unpow284.9%
sqr-neg84.9%
sin-neg84.9%
sin-neg84.9%
unpow284.9%
associate-*l/78.3%
associate-/l*85.0%
+-commutative85.0%
unpow285.0%
sin-neg85.0%
sin-neg85.0%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
associate-/l*46.7%
Simplified46.7%
if 9.9999999999999991e-97 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 58.1%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.00225) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (/ ky (/ (hypot ky (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00225) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00225) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.00225: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.00225) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.00225) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = ky / (hypot(ky, sin(kx)) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.00225], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.00225:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\end{array}
\end{array}
if th < 0.00224999999999999983Initial program 92.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 63.0%
if 0.00224999999999999983 < th Initial program 98.2%
unpow298.2%
sqr-neg98.2%
sin-neg98.2%
sin-neg98.2%
unpow298.2%
associate-*l/98.1%
associate-/l*98.2%
+-commutative98.2%
unpow298.2%
sin-neg98.2%
sin-neg98.2%
Simplified99.6%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 48.0%
Taylor expanded in ky around 0 61.6%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.00225) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (/ ky (/ (hypot ky (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00225) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = ky / (hypot(ky, sin(kx)) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00225) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = ky / (Math.hypot(ky, Math.sin(kx)) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.00225: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = ky / (math.hypot(ky, math.sin(kx)) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.00225) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(ky / Float64(hypot(ky, sin(kx)) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.00225) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = ky / (hypot(ky, sin(kx)) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.00225], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.00225:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\end{array}
\end{array}
if th < 0.00224999999999999983Initial program 92.1%
unpow292.1%
sqr-neg92.1%
sin-neg92.1%
sin-neg92.1%
unpow292.1%
associate-*l/88.0%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
Taylor expanded in th around 0 62.9%
if 0.00224999999999999983 < th Initial program 98.2%
unpow298.2%
sqr-neg98.2%
sin-neg98.2%
sin-neg98.2%
unpow298.2%
associate-*l/98.1%
associate-/l*98.2%
+-commutative98.2%
unpow298.2%
sin-neg98.2%
sin-neg98.2%
Simplified99.6%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 48.0%
Taylor expanded in ky around 0 61.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 15.5) (/ ky (/ (hypot ky (sin kx)) (sin th))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 15.5) {
tmp = ky / (hypot(ky, sin(kx)) / sin(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 <= 15.5) {
tmp = ky / (Math.hypot(ky, 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 <= 15.5: tmp = ky / (math.hypot(ky, 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 <= 15.5) tmp = Float64(ky / Float64(hypot(ky, 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 <= 15.5) tmp = ky / (hypot(ky, 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, 15.5], N[(ky / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $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 15.5:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 15.5Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.2%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 63.3%
Taylor expanded in ky around 0 73.1%
if 15.5 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 32.3%
add-sqr-sqrt30.6%
sqrt-prod60.0%
rem-sqrt-square60.0%
Applied egg-rr60.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9.4e-97) (* ky (/ (sin th) kx)) (if (<= ky 1e+99) (sin th) (fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.4e-97) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 1e+99) {
tmp = sin(th);
} else {
tmp = fabs(sin(th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 9.4d-97) then
tmp = ky * (sin(th) / kx)
else if (ky <= 1d+99) then
tmp = sin(th)
else
tmp = abs(sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.4e-97) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 1e+99) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.4e-97: tmp = ky * (math.sin(th) / kx) elif ky <= 1e+99: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.4e-97) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 1e+99) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 9.4e-97) tmp = ky * (sin(th) / kx); elseif (ky <= 1e+99) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.4e-97], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1e+99], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.4 \cdot 10^{-97}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 10^{+99}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 9.4000000000000004e-97Initial program 91.2%
clear-num91.2%
inv-pow91.2%
+-commutative91.2%
unpow291.2%
unpow291.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 27.8%
Taylor expanded in kx around 0 18.3%
associate-/l*19.2%
Simplified19.2%
if 9.4000000000000004e-97 < ky < 9.9999999999999997e98Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 45.8%
if 9.9999999999999997e98 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 27.8%
add-sqr-sqrt10.1%
sqrt-unprod19.8%
pow219.8%
Applied egg-rr19.8%
unpow219.8%
rem-sqrt-square25.7%
associate-*r/25.7%
*-rgt-identity25.7%
times-frac25.7%
*-inverses25.7%
/-rgt-identity25.7%
*-lft-identity25.7%
Simplified25.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9.2e-97) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.2e-97) {
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 <= 9.2d-97) 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 <= 9.2e-97) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.2e-97: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.2e-97) 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 <= 9.2e-97) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.2e-97], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.2 \cdot 10^{-97}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 9.19999999999999976e-97Initial program 91.2%
clear-num91.2%
inv-pow91.2%
+-commutative91.2%
unpow291.2%
unpow291.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 27.8%
Taylor expanded in kx around 0 18.3%
associate-/l*19.2%
Simplified19.2%
if 9.19999999999999976e-97 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 37.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.5e-15) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.5e-15) {
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 <= 6.5d-15) 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 <= 6.5e-15) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.5e-15: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.5e-15) 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 <= 6.5e-15) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.5e-15], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.5 \cdot 10^{-15}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 6.49999999999999991e-15Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.4%
associate-/l*91.9%
+-commutative91.9%
unpow291.9%
sin-neg91.9%
sin-neg91.9%
Simplified99.6%
Taylor expanded in kx around 0 29.8%
if 6.49999999999999991e-15 < kx Initial program 99.4%
clear-num99.3%
inv-pow99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 32.7%
Taylor expanded in th around 0 21.5%
associate-/l*22.7%
Simplified22.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.7e-12) (sin th) (log (+ th 1.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.7e-12) {
tmp = sin(th);
} else {
tmp = log((th + 1.0));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 5.7d-12) then
tmp = sin(th)
else
tmp = log((th + 1.0d0))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.7e-12) {
tmp = Math.sin(th);
} else {
tmp = Math.log((th + 1.0));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.7e-12: tmp = math.sin(th) else: tmp = math.log((th + 1.0)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.7e-12) tmp = sin(th); else tmp = log(Float64(th + 1.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 5.7e-12) tmp = sin(th); else tmp = log((th + 1.0)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.7e-12], N[Sin[th], $MachinePrecision], N[Log[N[(th + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.7 \cdot 10^{-12}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\log \left(th + 1\right)\\
\end{array}
\end{array}
if kx < 5.7000000000000003e-12Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.2%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
Taylor expanded in kx around 0 29.6%
if 5.7000000000000003e-12 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 7.7%
add-log-exp16.6%
Applied egg-rr16.6%
Taylor expanded in th around 0 14.8%
+-commutative14.8%
Simplified14.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.2e-12) (sin th) 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.2e-12) {
tmp = sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 3.2d-12) then
tmp = sin(th)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.2e-12) {
tmp = Math.sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.2e-12: tmp = math.sin(th) else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.2e-12) tmp = sin(th); else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.2e-12) tmp = sin(th); else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.2e-12], N[Sin[th], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.2 \cdot 10^{-12}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 3.2000000000000001e-12Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.2%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
Taylor expanded in kx around 0 29.6%
if 3.2000000000000001e-12 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 7.7%
add-log-exp16.6%
Applied egg-rr16.6%
Taylor expanded in th around 0 14.8%
+-commutative14.8%
Simplified14.8%
Taylor expanded in th around 0 15.1%
Final simplification26.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0008) th 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0008) {
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 <= 0.0008d0) 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 <= 0.0008) {
tmp = th;
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.0008: tmp = th else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.0008) tmp = th; else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.0008) tmp = th; else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.0008], th, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.0008:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 8.00000000000000038e-4Initial program 92.2%
unpow292.2%
sqr-neg92.2%
sin-neg92.2%
sin-neg92.2%
unpow292.2%
associate-*l/88.3%
associate-/l*92.1%
+-commutative92.1%
unpow292.1%
sin-neg92.1%
sin-neg92.1%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
Taylor expanded in th around 0 15.1%
if 8.00000000000000038e-4 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 7.3%
add-log-exp16.6%
Applied egg-rr16.6%
Taylor expanded in th around 0 15.3%
+-commutative15.3%
Simplified15.3%
Taylor expanded in th around 0 15.7%
Final simplification15.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.7%
unpow293.7%
sqr-neg93.7%
sin-neg93.7%
sin-neg93.7%
unpow293.7%
associate-*l/90.7%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.6%
Taylor expanded in kx around 0 24.6%
Taylor expanded in th around 0 13.2%
herbie shell --seed 2024150
(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)))