
(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 91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.82062)
(fabs (sin th))
(if (<= (sin th) -0.004)
(expm1 (log1p (sin th)))
(if (<= (sin th) 1e-8)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin th) 0.455)
(fabs (* ky (/ (sin th) (sin kx))))
(* (sin ky) (fabs (/ (sin th) (sin ky)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.82062) {
tmp = fabs(sin(th));
} else if (sin(th) <= -0.004) {
tmp = expm1(log1p(sin(th)));
} else if (sin(th) <= 1e-8) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(th) <= 0.455) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.82062) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= -0.004) {
tmp = Math.expm1(Math.log1p(Math.sin(th)));
} else if (Math.sin(th) <= 1e-8) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(th) <= 0.455) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.82062: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= -0.004: tmp = math.expm1(math.log1p(math.sin(th))) elif math.sin(th) <= 1e-8: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(th) <= 0.455: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.82062) tmp = abs(sin(th)); elseif (sin(th) <= -0.004) tmp = expm1(log1p(sin(th))); elseif (sin(th) <= 1e-8) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(th) <= 0.455) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.82062], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.004], N[(Exp[N[Log[1 + N[Sin[th], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-8], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.455], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.82062:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq -0.004:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin th\right)\right)\\
\mathbf{elif}\;\sin th \leq 10^{-8}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin th \leq 0.455:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.820620000000000016Initial program 96.4%
associate-*l/96.3%
associate-/l*96.4%
unpow296.4%
sqr-neg96.4%
sin-neg96.4%
sin-neg96.4%
unpow296.4%
unpow296.4%
sin-neg96.4%
sin-neg96.4%
sqr-neg96.4%
unpow296.4%
Simplified99.7%
Taylor expanded in kx around 0 28.3%
add-sqr-sqrt0.0%
sqrt-unprod33.7%
pow233.7%
Applied egg-rr33.7%
unpow233.7%
rem-sqrt-square33.7%
associate-*r/33.7%
*-rgt-identity33.7%
times-frac33.7%
/-rgt-identity33.7%
*-inverses33.7%
*-lft-identity33.7%
Simplified33.7%
if -0.820620000000000016 < (sin.f64 th) < -0.0040000000000000001Initial program 85.6%
associate-*l/85.4%
associate-/l*85.4%
unpow285.4%
sqr-neg85.4%
sin-neg85.4%
sin-neg85.4%
unpow285.4%
unpow285.4%
sin-neg85.4%
sin-neg85.4%
sqr-neg85.4%
unpow285.4%
Simplified99.5%
Taylor expanded in kx around 0 19.3%
expm1-log1p-u19.3%
expm1-undefine19.2%
Applied egg-rr19.2%
expm1-define19.3%
associate-*r/19.3%
*-rgt-identity19.3%
times-frac19.3%
/-rgt-identity19.3%
*-inverses19.3%
*-lft-identity19.3%
Simplified19.3%
if -0.0040000000000000001 < (sin.f64 th) < 1e-8Initial program 94.8%
associate-*l/89.8%
associate-/l*94.8%
unpow294.8%
sqr-neg94.8%
sin-neg94.8%
sin-neg94.8%
unpow294.8%
unpow294.8%
sin-neg94.8%
sin-neg94.8%
sqr-neg94.8%
unpow294.8%
Simplified99.8%
clear-num99.5%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 93.9%
associate-*l/93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine99.0%
*-lft-identity99.0%
hypot-undefine93.9%
unpow293.9%
unpow293.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-define99.0%
Simplified99.0%
if 1e-8 < (sin.f64 th) < 0.455000000000000016Initial program 91.5%
associate-*l/91.4%
associate-/l*91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
unpow291.5%
sin-neg91.5%
sin-neg91.5%
sqr-neg91.5%
unpow291.5%
Simplified99.6%
Taylor expanded in ky around 0 19.6%
add-sqr-sqrt5.3%
sqrt-unprod8.1%
pow28.1%
associate-/l*8.0%
Applied egg-rr8.0%
unpow28.0%
rem-sqrt-square19.4%
Simplified19.4%
if 0.455000000000000016 < (sin.f64 th) Initial program 86.4%
associate-*l/86.3%
associate-/l*86.5%
unpow286.5%
sqr-neg86.5%
sin-neg86.5%
sin-neg86.5%
unpow286.5%
unpow286.5%
sin-neg86.5%
sin-neg86.5%
sqr-neg86.5%
unpow286.5%
Simplified99.7%
Taylor expanded in kx around 0 25.7%
add-sqr-sqrt24.6%
sqrt-unprod46.1%
pow246.1%
Applied egg-rr46.1%
unpow246.1%
rem-sqrt-square53.4%
Simplified53.4%
Final simplification63.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(fabs (* ky t_1))
(if (<= (sin kx) 1e-202)
(sin th)
(if (<= (sin kx) 5e-106)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin kx) 2e-64)
(/ 1.0 (/ (sin ky) (* (sin ky) (sin th))))
(* (sin ky) t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 1e-202) {
tmp = sin(th);
} else if (sin(kx) <= 5e-106) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(kx) <= 2e-64) {
tmp = 1.0 / (sin(ky) / (sin(ky) * sin(th)));
} else {
tmp = sin(ky) * 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 = sin(th) / sin(kx)
if (sin(kx) <= (-0.02d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 1d-202) then
tmp = sin(th)
else if (sin(kx) <= 5d-106) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(kx) <= 2d-64) then
tmp = 1.0d0 / (sin(ky) / (sin(ky) * sin(th)))
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 1e-202) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-106) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(kx) <= 2e-64) {
tmp = 1.0 / (Math.sin(ky) / (Math.sin(ky) * Math.sin(th)));
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 1e-202: tmp = math.sin(th) elif math.sin(kx) <= 5e-106: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(kx) <= 2e-64: tmp = 1.0 / (math.sin(ky) / (math.sin(ky) * math.sin(th))) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 1e-202) tmp = sin(th); elseif (sin(kx) <= 5e-106) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(kx) <= 2e-64) tmp = Float64(1.0 / Float64(sin(ky) / Float64(sin(ky) * sin(th)))); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((ky * t_1)); elseif (sin(kx) <= 1e-202) tmp = sin(th); elseif (sin(kx) <= 5e-106) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(kx) <= 2e-64) tmp = 1.0 / (sin(ky) / (sin(ky) * sin(th))); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-202], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-106], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-64], N[(1.0 / N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-202}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-106}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{\frac{\sin ky}{\sin ky \cdot \sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 18.8%
add-sqr-sqrt15.7%
sqrt-unprod22.8%
pow222.8%
associate-/l*22.8%
Applied egg-rr22.8%
unpow222.8%
rem-sqrt-square32.8%
Simplified32.8%
if -0.0200000000000000004 < (sin.f64 kx) < 1e-202Initial program 78.8%
associate-*l/73.1%
associate-/l*78.8%
unpow278.8%
sqr-neg78.8%
sin-neg78.8%
sin-neg78.8%
unpow278.8%
unpow278.8%
sin-neg78.8%
sin-neg78.8%
sqr-neg78.8%
unpow278.8%
Simplified99.8%
Taylor expanded in kx around 0 41.5%
if 1e-202 < (sin.f64 kx) < 4.99999999999999983e-106Initial program 88.3%
associate-*l/83.4%
associate-/l*88.2%
unpow288.2%
sqr-neg88.2%
sin-neg88.2%
sin-neg88.2%
unpow288.2%
unpow288.2%
sin-neg88.2%
sin-neg88.2%
sqr-neg88.2%
unpow288.2%
Simplified99.8%
Taylor expanded in kx around 0 33.7%
add-sqr-sqrt16.3%
sqrt-unprod45.4%
pow245.4%
Applied egg-rr45.4%
unpow245.4%
rem-sqrt-square49.4%
Simplified49.4%
if 4.99999999999999983e-106 < (sin.f64 kx) < 1.99999999999999993e-64Initial program 100.0%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.6%
clear-num99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 72.0%
if 1.99999999999999993e-64 < (sin.f64 kx) Initial program 99.6%
associate-*l/99.4%
associate-/l*99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
sqr-neg99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in ky around 0 55.8%
Final simplification45.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (/ (sin th) (sin kx)))))
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 5e-220)
t_1
(if (<= (sin ky) 2e-200)
(/ 1.0 (/ 1.0 (sin th)))
(if (<= (sin ky) 1e-187) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = ky * (sin(th) / sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-220) {
tmp = t_1;
} else if (sin(ky) <= 2e-200) {
tmp = 1.0 / (1.0 / sin(th));
} else if (sin(ky) <= 1e-187) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = ky * (sin(th) / sin(kx))
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-220) then
tmp = t_1
else if (sin(ky) <= 2d-200) then
tmp = 1.0d0 / (1.0d0 / sin(th))
else if (sin(ky) <= 1d-187) then
tmp = t_1
else
tmp = sin(th)
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(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-220) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-200) {
tmp = 1.0 / (1.0 / Math.sin(th));
} else if (Math.sin(ky) <= 1e-187) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * (math.sin(th) / math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-220: tmp = t_1 elif math.sin(ky) <= 2e-200: tmp = 1.0 / (1.0 / math.sin(th)) elif math.sin(ky) <= 1e-187: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky * Float64(sin(th) / sin(kx))) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-220) tmp = t_1; elseif (sin(ky) <= 2e-200) tmp = Float64(1.0 / Float64(1.0 / sin(th))); elseif (sin(ky) <= 1e-187) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky * (sin(th) / sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-220) tmp = t_1; elseif (sin(ky) <= 2e-200) tmp = 1.0 / (1.0 / sin(th)); elseif (sin(ky) <= 1e-187) tmp = t_1; else tmp = sin(th); 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[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-220], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-200], N[(1.0 / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-187], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-220}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-200}:\\
\;\;\;\;\frac{1}{\frac{1}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.2%
sqrt-unprod25.5%
pow225.5%
Applied egg-rr25.5%
unpow225.5%
rem-sqrt-square27.5%
associate-*r/27.5%
*-rgt-identity27.5%
times-frac27.5%
/-rgt-identity27.5%
*-inverses27.5%
*-lft-identity27.5%
Simplified27.5%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000002e-220 or 2e-200 < (sin.f64 ky) < 1e-187Initial program 82.5%
associate-*l/78.4%
associate-/l*82.5%
unpow282.5%
sqr-neg82.5%
sin-neg82.5%
sin-neg82.5%
unpow282.5%
unpow282.5%
sin-neg82.5%
sin-neg82.5%
sqr-neg82.5%
unpow282.5%
Simplified99.8%
Taylor expanded in ky around 0 51.6%
associate-/l*53.9%
Simplified53.9%
if 5.0000000000000002e-220 < (sin.f64 ky) < 2e-200Initial program 2.4%
associate-*l/1.6%
associate-/l*2.4%
unpow22.4%
sqr-neg2.4%
sin-neg2.4%
sin-neg2.4%
unpow22.4%
unpow22.4%
sin-neg2.4%
sin-neg2.4%
sqr-neg2.4%
unpow22.4%
Simplified100.0%
associate-*r/53.7%
clear-num53.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in kx around 0 100.0%
if 1e-187 < (sin.f64 ky) Initial program 96.3%
associate-*l/93.4%
associate-/l*96.2%
unpow296.2%
sqr-neg96.2%
sin-neg96.2%
sin-neg96.2%
unpow296.2%
unpow296.2%
sin-neg96.2%
sin-neg96.2%
sqr-neg96.2%
unpow296.2%
Simplified99.7%
Taylor expanded in kx around 0 61.4%
Final simplification48.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (/ (sin kx) (sin th)))))
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 5e-220)
t_1
(if (<= (sin ky) 2e-200)
(/ 1.0 (/ 1.0 (sin th)))
(if (<= (sin ky) 1e-187) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = ky / (sin(kx) / sin(th));
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-220) {
tmp = t_1;
} else if (sin(ky) <= 2e-200) {
tmp = 1.0 / (1.0 / sin(th));
} else if (sin(ky) <= 1e-187) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = ky / (sin(kx) / sin(th))
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-220) then
tmp = t_1
else if (sin(ky) <= 2d-200) then
tmp = 1.0d0 / (1.0d0 / sin(th))
else if (sin(ky) <= 1d-187) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / (Math.sin(kx) / Math.sin(th));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-220) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-200) {
tmp = 1.0 / (1.0 / Math.sin(th));
} else if (Math.sin(ky) <= 1e-187) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / (math.sin(kx) / math.sin(th)) tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-220: tmp = t_1 elif math.sin(ky) <= 2e-200: tmp = 1.0 / (1.0 / math.sin(th)) elif math.sin(ky) <= 1e-187: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky / Float64(sin(kx) / sin(th))) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-220) tmp = t_1; elseif (sin(ky) <= 2e-200) tmp = Float64(1.0 / Float64(1.0 / sin(th))); elseif (sin(ky) <= 1e-187) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / (sin(kx) / sin(th)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-220) tmp = t_1; elseif (sin(ky) <= 2e-200) tmp = 1.0 / (1.0 / sin(th)); elseif (sin(ky) <= 1e-187) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-220], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-200], N[(1.0 / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-187], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-220}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-200}:\\
\;\;\;\;\frac{1}{\frac{1}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.2%
sqrt-unprod25.5%
pow225.5%
Applied egg-rr25.5%
unpow225.5%
rem-sqrt-square27.5%
associate-*r/27.5%
*-rgt-identity27.5%
times-frac27.5%
/-rgt-identity27.5%
*-inverses27.5%
*-lft-identity27.5%
Simplified27.5%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000002e-220 or 2e-200 < (sin.f64 ky) < 1e-187Initial program 82.5%
associate-*l/78.4%
associate-/l*82.5%
unpow282.5%
sqr-neg82.5%
sin-neg82.5%
sin-neg82.5%
unpow282.5%
unpow282.5%
sin-neg82.5%
sin-neg82.5%
sqr-neg82.5%
unpow282.5%
Simplified99.8%
Taylor expanded in ky around 0 51.6%
associate-/l*53.9%
*-commutative53.9%
Applied egg-rr53.9%
*-commutative53.9%
clear-num53.9%
un-div-inv53.9%
Applied egg-rr53.9%
if 5.0000000000000002e-220 < (sin.f64 ky) < 2e-200Initial program 2.4%
associate-*l/1.6%
associate-/l*2.4%
unpow22.4%
sqr-neg2.4%
sin-neg2.4%
sin-neg2.4%
unpow22.4%
unpow22.4%
sin-neg2.4%
sin-neg2.4%
sqr-neg2.4%
unpow22.4%
Simplified100.0%
associate-*r/53.7%
clear-num53.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in kx around 0 100.0%
if 1e-187 < (sin.f64 ky) Initial program 96.3%
associate-*l/93.4%
associate-/l*96.2%
unpow296.2%
sqr-neg96.2%
sin-neg96.2%
sin-neg96.2%
unpow296.2%
unpow296.2%
sin-neg96.2%
sin-neg96.2%
sqr-neg96.2%
unpow296.2%
Simplified99.7%
Taylor expanded in kx around 0 61.4%
Final simplification48.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(fabs (* ky t_1))
(if (<= (sin kx) 2e-64) (sin th) (* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 2e-64) {
tmp = sin(th);
} else {
tmp = sin(ky) * 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 = sin(th) / sin(kx)
if (sin(kx) <= (-0.02d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 2d-64) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 2e-64) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 2e-64: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 2e-64) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((ky * t_1)); elseif (sin(kx) <= 2e-64) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-64], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 18.8%
add-sqr-sqrt15.7%
sqrt-unprod22.8%
pow222.8%
associate-/l*22.8%
Applied egg-rr22.8%
unpow222.8%
rem-sqrt-square32.8%
Simplified32.8%
if -0.0200000000000000004 < (sin.f64 kx) < 1.99999999999999993e-64Initial program 82.2%
associate-*l/77.0%
associate-/l*82.1%
unpow282.1%
sqr-neg82.1%
sin-neg82.1%
sin-neg82.1%
unpow282.1%
unpow282.1%
sin-neg82.1%
sin-neg82.1%
sqr-neg82.1%
unpow282.1%
Simplified99.8%
Taylor expanded in kx around 0 40.9%
if 1.99999999999999993e-64 < (sin.f64 kx) Initial program 99.6%
associate-*l/99.4%
associate-/l*99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
sqr-neg99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in ky around 0 55.8%
Final simplification44.1%
(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 91.8%
associate-*l/89.4%
associate-/l*91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
unpow291.7%
sin-neg91.7%
sin-neg91.7%
sqr-neg91.7%
unpow291.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th 108.0)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (or (<= th 5.8e+35) (not (<= th 1.45e+86)))
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* ky (sin th))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 108.0) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if ((th <= 5.8e+35) || !(th <= 1.45e+86)) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 108.0) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if ((th <= 5.8e+35) || !(th <= 1.45e+86)) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (ky * Math.sin(th)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 108.0: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif (th <= 5.8e+35) or not (th <= 1.45e+86): tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (ky * math.sin(th))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 108.0) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif ((th <= 5.8e+35) || !(th <= 1.45e+86)) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(ky * sin(th)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 108.0) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif ((th <= 5.8e+35) || ~((th <= 1.45e+86))) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 108.0], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 5.8e+35], N[Not[LessEqual[th, 1.45e+86]], $MachinePrecision]], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 108:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;th \leq 5.8 \cdot 10^{+35} \lor \neg \left(th \leq 1.45 \cdot 10^{+86}\right):\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky \cdot \sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 108Initial program 92.4%
associate-*l/89.1%
associate-/l*92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
sqr-neg92.4%
unpow292.4%
Simplified99.8%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 61.4%
associate-*l/61.4%
+-commutative61.4%
unpow261.4%
unpow261.4%
hypot-undefine64.7%
*-lft-identity64.7%
hypot-undefine61.4%
unpow261.4%
unpow261.4%
+-commutative61.4%
unpow261.4%
unpow261.4%
hypot-define64.7%
Simplified64.7%
if 108 < th < 5.79999999999999989e35 or 1.44999999999999995e86 < th Initial program 89.3%
associate-*l/89.1%
associate-/l*89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
unpow289.2%
sin-neg89.2%
sin-neg89.2%
sqr-neg89.2%
unpow289.2%
Simplified99.6%
associate-*r/99.3%
clear-num99.3%
*-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
if 5.79999999999999989e35 < th < 1.44999999999999995e86Initial program 93.0%
associate-*l/93.3%
associate-/l*93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
unpow293.1%
sin-neg93.1%
sin-neg93.1%
sqr-neg93.1%
unpow293.1%
Simplified99.4%
Taylor expanded in kx around 0 21.8%
Final simplification58.5%
(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-64) (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-64) {
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-64) 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-64) {
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-64: 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-64) 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-64) 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-64], 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^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 18.8%
add-sqr-sqrt15.7%
sqrt-unprod22.8%
pow222.8%
associate-/l*22.8%
Applied egg-rr22.8%
unpow222.8%
rem-sqrt-square32.8%
Simplified32.8%
if -0.0200000000000000004 < (sin.f64 kx) < 1.99999999999999993e-64Initial program 82.2%
associate-*l/77.0%
associate-/l*82.1%
unpow282.1%
sqr-neg82.1%
sin-neg82.1%
sin-neg82.1%
unpow282.1%
unpow282.1%
sin-neg82.1%
sin-neg82.1%
sqr-neg82.1%
unpow282.1%
Simplified99.8%
Taylor expanded in kx around 0 40.9%
if 1.99999999999999993e-64 < (sin.f64 kx) Initial program 99.6%
associate-*l/99.4%
associate-/l*99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
sqr-neg99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in ky around 0 47.3%
associate-/l*47.5%
Simplified47.5%
Final simplification41.3%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 8.5e-217)
(* ky (/ (sin th) kx))
(if (<= ky 1.9e-200)
(/ 1.0 (/ 1.0 (sin th)))
(if (<= ky 8.5e-188)
(/ (* ky (sin th)) kx)
(if (or (<= ky 330.0) (not (<= ky 1.75e+77)))
(sin th)
(fabs (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.5e-217) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 1.9e-200) {
tmp = 1.0 / (1.0 / sin(th));
} else if (ky <= 8.5e-188) {
tmp = (ky * sin(th)) / kx;
} else if ((ky <= 330.0) || !(ky <= 1.75e+77)) {
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 <= 8.5d-217) then
tmp = ky * (sin(th) / kx)
else if (ky <= 1.9d-200) then
tmp = 1.0d0 / (1.0d0 / sin(th))
else if (ky <= 8.5d-188) then
tmp = (ky * sin(th)) / kx
else if ((ky <= 330.0d0) .or. (.not. (ky <= 1.75d+77))) 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 <= 8.5e-217) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 1.9e-200) {
tmp = 1.0 / (1.0 / Math.sin(th));
} else if (ky <= 8.5e-188) {
tmp = (ky * Math.sin(th)) / kx;
} else if ((ky <= 330.0) || !(ky <= 1.75e+77)) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.5e-217: tmp = ky * (math.sin(th) / kx) elif ky <= 1.9e-200: tmp = 1.0 / (1.0 / math.sin(th)) elif ky <= 8.5e-188: tmp = (ky * math.sin(th)) / kx elif (ky <= 330.0) or not (ky <= 1.75e+77): tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.5e-217) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 1.9e-200) tmp = Float64(1.0 / Float64(1.0 / sin(th))); elseif (ky <= 8.5e-188) tmp = Float64(Float64(ky * sin(th)) / kx); elseif ((ky <= 330.0) || !(ky <= 1.75e+77)) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.5e-217) tmp = ky * (sin(th) / kx); elseif (ky <= 1.9e-200) tmp = 1.0 / (1.0 / sin(th)); elseif (ky <= 8.5e-188) tmp = (ky * sin(th)) / kx; elseif ((ky <= 330.0) || ~((ky <= 1.75e+77))) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.5e-217], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.9e-200], N[(1.0 / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8.5e-188], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], If[Or[LessEqual[ky, 330.0], N[Not[LessEqual[ky, 1.75e+77]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-217}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-200}:\\
\;\;\;\;\frac{1}{\frac{1}{\sin th}}\\
\mathbf{elif}\;ky \leq 8.5 \cdot 10^{-188}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{elif}\;ky \leq 330 \lor \neg \left(ky \leq 1.75 \cdot 10^{+77}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 8.4999999999999994e-217Initial program 89.7%
associate-*l/87.3%
associate-/l*89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
unpow289.8%
sin-neg89.8%
sin-neg89.8%
sqr-neg89.8%
unpow289.8%
Simplified99.7%
Taylor expanded in ky around 0 29.9%
Taylor expanded in kx around 0 22.4%
associate-/l*23.7%
Simplified23.7%
if 8.4999999999999994e-217 < ky < 1.9e-200Initial program 2.4%
associate-*l/1.6%
associate-/l*2.4%
unpow22.4%
sqr-neg2.4%
sin-neg2.4%
sin-neg2.4%
unpow22.4%
unpow22.4%
sin-neg2.4%
sin-neg2.4%
sqr-neg2.4%
unpow22.4%
Simplified100.0%
associate-*r/53.7%
clear-num53.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in kx around 0 100.0%
if 1.9e-200 < ky < 8.5000000000000004e-188Initial program 100.0%
associate-*l/100.0%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 67.9%
Taylor expanded in kx around 0 68.4%
if 8.5000000000000004e-188 < ky < 330 or 1.7500000000000001e77 < ky Initial program 96.3%
associate-*l/93.7%
associate-/l*96.3%
unpow296.3%
sqr-neg96.3%
sin-neg96.3%
sin-neg96.3%
unpow296.3%
unpow296.3%
sin-neg96.3%
sin-neg96.3%
sqr-neg96.3%
unpow296.3%
Simplified99.7%
Taylor expanded in kx around 0 38.6%
if 330 < ky < 1.7500000000000001e77Initial program 100.0%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
sqr-neg99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 18.5%
add-sqr-sqrt14.6%
sqrt-unprod37.4%
pow237.4%
Applied egg-rr37.4%
unpow237.4%
rem-sqrt-square50.2%
associate-*r/50.1%
*-rgt-identity50.1%
times-frac50.4%
/-rgt-identity50.4%
*-inverses50.4%
*-lft-identity50.4%
Simplified50.4%
Final simplification30.8%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky 8.5e-217) (and (not (<= ky 1.9e-200)) (<= ky 1.12e-187))) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 8.5e-217) || (!(ky <= 1.9e-200) && (ky <= 1.12e-187))) {
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 <= 8.5d-217) .or. (.not. (ky <= 1.9d-200)) .and. (ky <= 1.12d-187)) 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 <= 8.5e-217) || (!(ky <= 1.9e-200) && (ky <= 1.12e-187))) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= 8.5e-217) or (not (ky <= 1.9e-200) and (ky <= 1.12e-187)): tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= 8.5e-217) || (!(ky <= 1.9e-200) && (ky <= 1.12e-187))) 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 <= 8.5e-217) || (~((ky <= 1.9e-200)) && (ky <= 1.12e-187))) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, 8.5e-217], And[N[Not[LessEqual[ky, 1.9e-200]], $MachinePrecision], LessEqual[ky, 1.12e-187]]], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-217} \lor \neg \left(ky \leq 1.9 \cdot 10^{-200}\right) \land ky \leq 1.12 \cdot 10^{-187}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.4999999999999994e-217 or 1.9e-200 < ky < 1.12e-187Initial program 89.9%
associate-*l/87.6%
associate-/l*90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
sqr-neg90.0%
unpow290.0%
Simplified99.7%
Taylor expanded in ky around 0 30.6%
Taylor expanded in kx around 0 23.3%
associate-/l*24.5%
Simplified24.5%
if 8.4999999999999994e-217 < ky < 1.9e-200 or 1.12e-187 < ky Initial program 94.7%
associate-*l/92.3%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.7%
Taylor expanded in kx around 0 38.0%
Final simplification29.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (/ (sin th) kx))))
(if (<= ky 8.5e-217)
t_1
(if (<= ky 9.2e-199)
(/ 1.0 (/ 1.0 (sin th)))
(if (<= ky 1.12e-187) t_1 (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = ky * (sin(th) / kx);
double tmp;
if (ky <= 8.5e-217) {
tmp = t_1;
} else if (ky <= 9.2e-199) {
tmp = 1.0 / (1.0 / sin(th));
} else if (ky <= 1.12e-187) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = ky * (sin(th) / kx)
if (ky <= 8.5d-217) then
tmp = t_1
else if (ky <= 9.2d-199) then
tmp = 1.0d0 / (1.0d0 / sin(th))
else if (ky <= 1.12d-187) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky * (Math.sin(th) / kx);
double tmp;
if (ky <= 8.5e-217) {
tmp = t_1;
} else if (ky <= 9.2e-199) {
tmp = 1.0 / (1.0 / Math.sin(th));
} else if (ky <= 1.12e-187) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * (math.sin(th) / kx) tmp = 0 if ky <= 8.5e-217: tmp = t_1 elif ky <= 9.2e-199: tmp = 1.0 / (1.0 / math.sin(th)) elif ky <= 1.12e-187: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky * Float64(sin(th) / kx)) tmp = 0.0 if (ky <= 8.5e-217) tmp = t_1; elseif (ky <= 9.2e-199) tmp = Float64(1.0 / Float64(1.0 / sin(th))); elseif (ky <= 1.12e-187) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky * (sin(th) / kx); tmp = 0.0; if (ky <= 8.5e-217) tmp = t_1; elseif (ky <= 9.2e-199) tmp = 1.0 / (1.0 / sin(th)); elseif (ky <= 1.12e-187) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 8.5e-217], t$95$1, If[LessEqual[ky, 9.2e-199], N[(1.0 / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.12e-187], t$95$1, N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \frac{\sin th}{kx}\\
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-217}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ky \leq 9.2 \cdot 10^{-199}:\\
\;\;\;\;\frac{1}{\frac{1}{\sin th}}\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.4999999999999994e-217 or 9.2000000000000005e-199 < ky < 1.12e-187Initial program 89.9%
associate-*l/87.6%
associate-/l*90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
sqr-neg90.0%
unpow290.0%
Simplified99.7%
Taylor expanded in ky around 0 30.6%
Taylor expanded in kx around 0 23.3%
associate-/l*24.5%
Simplified24.5%
if 8.4999999999999994e-217 < ky < 9.2000000000000005e-199Initial program 2.4%
associate-*l/1.6%
associate-/l*2.4%
unpow22.4%
sqr-neg2.4%
sin-neg2.4%
sin-neg2.4%
unpow22.4%
unpow22.4%
sin-neg2.4%
sin-neg2.4%
sqr-neg2.4%
unpow22.4%
Simplified100.0%
associate-*r/53.7%
clear-num53.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in kx around 0 100.0%
if 1.12e-187 < ky Initial program 96.7%
associate-*l/94.2%
associate-/l*96.6%
unpow296.6%
sqr-neg96.6%
sin-neg96.6%
sin-neg96.6%
unpow296.6%
unpow296.6%
sin-neg96.6%
sin-neg96.6%
sqr-neg96.6%
unpow296.6%
Simplified99.7%
Taylor expanded in kx around 0 36.7%
Final simplification29.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 8.5e-217)
(* ky (/ (sin th) kx))
(if (<= ky 1.9e-200)
(/ 1.0 (/ 1.0 (sin th)))
(if (<= ky 1.12e-187) (/ (* ky (sin th)) kx) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.5e-217) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 1.9e-200) {
tmp = 1.0 / (1.0 / sin(th));
} else if (ky <= 1.12e-187) {
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 <= 8.5d-217) then
tmp = ky * (sin(th) / kx)
else if (ky <= 1.9d-200) then
tmp = 1.0d0 / (1.0d0 / sin(th))
else if (ky <= 1.12d-187) 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 <= 8.5e-217) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 1.9e-200) {
tmp = 1.0 / (1.0 / Math.sin(th));
} else if (ky <= 1.12e-187) {
tmp = (ky * Math.sin(th)) / kx;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.5e-217: tmp = ky * (math.sin(th) / kx) elif ky <= 1.9e-200: tmp = 1.0 / (1.0 / math.sin(th)) elif ky <= 1.12e-187: tmp = (ky * math.sin(th)) / kx else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.5e-217) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 1.9e-200) tmp = Float64(1.0 / Float64(1.0 / sin(th))); elseif (ky <= 1.12e-187) tmp = Float64(Float64(ky * sin(th)) / kx); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.5e-217) tmp = ky * (sin(th) / kx); elseif (ky <= 1.9e-200) tmp = 1.0 / (1.0 / sin(th)); elseif (ky <= 1.12e-187) tmp = (ky * sin(th)) / kx; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.5e-217], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.9e-200], N[(1.0 / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.12e-187], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-217}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-200}:\\
\;\;\;\;\frac{1}{\frac{1}{\sin th}}\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-187}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.4999999999999994e-217Initial program 89.7%
associate-*l/87.3%
associate-/l*89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
unpow289.8%
sin-neg89.8%
sin-neg89.8%
sqr-neg89.8%
unpow289.8%
Simplified99.7%
Taylor expanded in ky around 0 29.9%
Taylor expanded in kx around 0 22.4%
associate-/l*23.7%
Simplified23.7%
if 8.4999999999999994e-217 < ky < 1.9e-200Initial program 2.4%
associate-*l/1.6%
associate-/l*2.4%
unpow22.4%
sqr-neg2.4%
sin-neg2.4%
sin-neg2.4%
unpow22.4%
unpow22.4%
sin-neg2.4%
sin-neg2.4%
sqr-neg2.4%
unpow22.4%
Simplified100.0%
associate-*r/53.7%
clear-num53.7%
*-commutative53.7%
Applied egg-rr53.7%
Taylor expanded in kx around 0 100.0%
if 1.9e-200 < ky < 1.12e-187Initial program 100.0%
associate-*l/100.0%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 67.9%
Taylor expanded in kx around 0 68.4%
if 1.12e-187 < ky Initial program 96.7%
associate-*l/94.2%
associate-/l*96.6%
unpow296.6%
sqr-neg96.6%
sin-neg96.6%
sin-neg96.6%
unpow296.6%
unpow296.6%
sin-neg96.6%
sin-neg96.6%
sqr-neg96.6%
unpow296.6%
Simplified99.7%
Taylor expanded in kx around 0 36.7%
Final simplification29.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.9e-9) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.9e-9) {
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 <= 5.9d-9) 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 <= 5.9e-9) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.9e-9: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.9e-9) 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 <= 5.9e-9) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.9e-9], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.9 \cdot 10^{-9}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 5.8999999999999999e-9Initial program 89.5%
associate-*l/86.4%
associate-/l*89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
unpow289.5%
sin-neg89.5%
sin-neg89.5%
sqr-neg89.5%
unpow289.5%
Simplified99.8%
Taylor expanded in kx around 0 27.4%
if 5.8999999999999999e-9 < kx Initial program 99.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in ky around 0 25.0%
Taylor expanded in th around 0 16.4%
associate-/l*16.5%
Simplified16.5%
Final simplification24.9%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 91.8%
associate-*l/89.4%
associate-/l*91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
unpow291.7%
sin-neg91.7%
sin-neg91.7%
sqr-neg91.7%
unpow291.7%
Simplified99.7%
Taylor expanded in kx around 0 22.9%
Final simplification22.9%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (* th 0.16666666666666666) (/ 1.0 th))))
double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((th * 0.16666666666666666d0) + (1.0d0 / th))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
def code(kx, ky, th): return 1.0 / ((th * 0.16666666666666666) + (1.0 / th))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((th * 0.16666666666666666) + (1.0 / th)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{th \cdot 0.16666666666666666 + \frac{1}{th}}
\end{array}
Initial program 91.8%
associate-*l/89.4%
associate-/l*91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
unpow291.7%
sin-neg91.7%
sin-neg91.7%
sqr-neg91.7%
unpow291.7%
Simplified99.7%
associate-*r/95.8%
clear-num95.7%
*-commutative95.7%
Applied egg-rr95.7%
Taylor expanded in kx around 0 30.7%
Taylor expanded in th around 0 12.6%
Final simplification12.6%
(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 91.8%
associate-*l/89.4%
associate-/l*91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
unpow291.7%
sin-neg91.7%
sin-neg91.7%
sqr-neg91.7%
unpow291.7%
Simplified99.7%
Taylor expanded in kx around 0 22.9%
Taylor expanded in th around 0 11.9%
Final simplification11.9%
herbie shell --seed 2024041
(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)))