
(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 20 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}
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (* (expm1 (log1p (/ (sin ky_m) (hypot (sin ky_m) (sin kx))))) (sin th))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * (expm1(log1p((sin(ky_m) / hypot(sin(ky_m), sin(kx))))) * sin(th));
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * (Math.expm1(Math.log1p((Math.sin(ky_m) / Math.hypot(Math.sin(ky_m), Math.sin(kx))))) * Math.sin(th));
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): return ky_s * (math.expm1(math.log1p((math.sin(ky_m) / math.hypot(math.sin(ky_m), math.sin(kx))))) * math.sin(th))
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) return Float64(ky_s * Float64(expm1(log1p(Float64(sin(ky_m) / hypot(sin(ky_m), sin(kx))))) * sin(th))) end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * N[(N[(Exp[N[Log[1 + N[(N[Sin[ky$95$m], $MachinePrecision] / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin ky\_m}{\mathsf{hypot}\left(\sin ky\_m, \sin kx\right)}\right)\right) \cdot \sin th\right)
\end{array}
Initial program 91.5%
expm1-log1p-u91.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-undefine99.7%
Applied egg-rr99.7%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(* (sin ky_m) (/ th (hypot (sin ky_m) (sin kx))))
(if (<= (sin ky_m) 2e-7)
(* (sin ky_m) (/ (sin th) (hypot ky_m (sin kx))))
(sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = sin(ky_m) * (th / hypot(sin(ky_m), sin(kx)));
} else if (sin(ky_m) <= 2e-7) {
tmp = sin(ky_m) * (sin(th) / hypot(ky_m, sin(kx)));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.sin(ky_m) * (th / Math.hypot(Math.sin(ky_m), Math.sin(kx)));
} else if (Math.sin(ky_m) <= 2e-7) {
tmp = Math.sin(ky_m) * (Math.sin(th) / Math.hypot(ky_m, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.sin(ky_m) * (th / math.hypot(math.sin(ky_m), math.sin(kx))) elif math.sin(ky_m) <= 2e-7: tmp = math.sin(ky_m) * (math.sin(th) / math.hypot(ky_m, math.sin(kx))) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = Float64(sin(ky_m) * Float64(th / hypot(sin(ky_m), sin(kx)))); elseif (sin(ky_m) <= 2e-7) tmp = Float64(sin(ky_m) * Float64(sin(th) / hypot(ky_m, sin(kx)))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = sin(ky_m) * (th / hypot(sin(ky_m), sin(kx))); elseif (sin(ky_m) <= 2e-7) tmp = sin(ky_m) * (sin(th) / hypot(ky_m, sin(kx))); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[(N[Sin[ky$95$m], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 2e-7], N[(N[Sin[ky$95$m], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky$95$m ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\sin ky\_m \cdot \frac{th}{\mathsf{hypot}\left(\sin ky\_m, \sin kx\right)}\\
\mathbf{elif}\;\sin ky\_m \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin ky\_m \cdot \frac{\sin th}{\mathsf{hypot}\left(ky\_m, \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.6%
Taylor expanded in th around 0 50.6%
if -0.0200000000000000004 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 84.4%
unpow284.4%
sqr-neg84.4%
sin-neg84.4%
sin-neg84.4%
unpow284.4%
associate-*l/82.0%
associate-/l*84.3%
+-commutative84.3%
unpow284.3%
sin-neg84.3%
sin-neg84.3%
Simplified99.6%
Taylor expanded in ky around 0 99.2%
if 1.9999999999999999e-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 66.4%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(/ (sin ky_m) (/ (hypot (sin ky_m) kx) th))
(if (<= (sin ky_m) 1e-94)
(* (sin th) (/ (sin ky_m) (fabs (sin kx))))
(sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th);
} else if (sin(ky_m) <= 1e-94) {
tmp = sin(th) * (sin(ky_m) / fabs(sin(kx)));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.sin(ky_m) / (Math.hypot(Math.sin(ky_m), kx) / th);
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = Math.sin(th) * (Math.sin(ky_m) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.sin(ky_m) / (math.hypot(math.sin(ky_m), kx) / th) elif math.sin(ky_m) <= 1e-94: tmp = math.sin(th) * (math.sin(ky_m) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = Float64(sin(ky_m) / Float64(hypot(sin(ky_m), kx) / th)); elseif (sin(ky_m) <= 1e-94) tmp = Float64(sin(th) * Float64(sin(ky_m) / abs(sin(kx)))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th); elseif (sin(ky_m) <= 1e-94) tmp = sin(th) * (sin(ky_m) / abs(sin(kx))); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[(N[Sin[ky$95$m], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky$95$m], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\frac{\sin ky\_m}{\frac{\mathsf{hypot}\left(\sin ky\_m, kx\right)}{th}}\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky\_m}{\left|\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.6%
clear-num99.2%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 50.6%
Taylor expanded in kx around 0 33.1%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 82.6%
Taylor expanded in ky around 0 44.6%
add-sqr-sqrt39.0%
sqrt-prod62.9%
rem-sqrt-square74.3%
Applied egg-rr74.3%
if 9.9999999999999996e-95 < (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 64.9%
Final simplification62.0%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(/ (sin ky_m) (/ (hypot (sin ky_m) kx) th))
(if (<= (sin ky_m) 1e-94)
(/ 1.0 (/ (/ (fabs (sin kx)) (sin th)) ky_m))
(sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th);
} else if (sin(ky_m) <= 1e-94) {
tmp = 1.0 / ((fabs(sin(kx)) / sin(th)) / ky_m);
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.sin(ky_m) / (Math.hypot(Math.sin(ky_m), kx) / th);
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = 1.0 / ((Math.abs(Math.sin(kx)) / Math.sin(th)) / ky_m);
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.sin(ky_m) / (math.hypot(math.sin(ky_m), kx) / th) elif math.sin(ky_m) <= 1e-94: tmp = 1.0 / ((math.fabs(math.sin(kx)) / math.sin(th)) / ky_m) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = Float64(sin(ky_m) / Float64(hypot(sin(ky_m), kx) / th)); elseif (sin(ky_m) <= 1e-94) tmp = Float64(1.0 / Float64(Float64(abs(sin(kx)) / sin(th)) / ky_m)); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th); elseif (sin(ky_m) <= 1e-94) tmp = 1.0 / ((abs(sin(kx)) / sin(th)) / ky_m); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[(N[Sin[ky$95$m], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[(1.0 / N[(N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky$95$m), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\frac{\sin ky\_m}{\frac{\mathsf{hypot}\left(\sin ky\_m, kx\right)}{th}}\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;\frac{1}{\frac{\frac{\left|\sin kx\right|}{\sin th}}{ky\_m}}\\
\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.6%
clear-num99.2%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 50.6%
Taylor expanded in kx around 0 33.1%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 82.6%
Taylor expanded in ky around 0 44.6%
associate-*l/42.2%
clear-num41.7%
Applied egg-rr41.7%
Taylor expanded in ky around 0 41.7%
*-commutative41.7%
associate-/r*43.9%
Simplified43.9%
add-sqr-sqrt39.0%
sqrt-prod62.9%
rem-sqrt-square74.3%
Applied egg-rr73.3%
if 9.9999999999999996e-95 < (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 64.9%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) 5e-308)
(/ (sin ky_m) (/ (hypot (sin ky_m) kx) th))
(if (<= (sin ky_m) 1e-94)
(fabs (* ky_m (/ (sin th) (sin kx))))
(sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= 5e-308) {
tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th);
} else if (sin(ky_m) <= 1e-94) {
tmp = fabs((ky_m * (sin(th) / sin(kx))));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= 5e-308) {
tmp = Math.sin(ky_m) / (Math.hypot(Math.sin(ky_m), kx) / th);
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = Math.abs((ky_m * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= 5e-308: tmp = math.sin(ky_m) / (math.hypot(math.sin(ky_m), kx) / th) elif math.sin(ky_m) <= 1e-94: tmp = math.fabs((ky_m * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= 5e-308) tmp = Float64(sin(ky_m) / Float64(hypot(sin(ky_m), kx) / th)); elseif (sin(ky_m) <= 1e-94) tmp = abs(Float64(ky_m * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= 5e-308) tmp = sin(ky_m) / (hypot(sin(ky_m), kx) / th); elseif (sin(ky_m) <= 1e-94) tmp = abs((ky_m * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 5e-308], N[(N[Sin[ky$95$m], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[Abs[N[(ky$95$m * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq 5 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sin ky\_m}{\frac{\mathsf{hypot}\left(\sin ky\_m, kx\right)}{th}}\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;\left|ky\_m \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.99999999999999955e-308Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/89.1%
associate-/l*91.5%
+-commutative91.5%
unpow291.5%
sin-neg91.5%
sin-neg91.5%
Simplified99.6%
clear-num99.4%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 51.8%
Taylor expanded in kx around 0 37.0%
if 4.99999999999999955e-308 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 79.3%
Taylor expanded in ky around 0 51.6%
associate-*l/51.6%
clear-num50.5%
Applied egg-rr50.5%
Taylor expanded in ky around 0 50.5%
*-commutative50.5%
associate-/r*50.4%
Simplified50.4%
add-sqr-sqrt29.7%
sqrt-unprod37.8%
pow237.8%
clear-num37.9%
associate-/r/37.9%
Applied egg-rr37.9%
unpow237.9%
rem-sqrt-square51.0%
associate-*l/49.1%
associate-*r/50.8%
Simplified50.8%
if 9.9999999999999996e-95 < (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 64.9%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(fabs (sin th))
(if (<= (sin ky_m) 1e-94)
(fabs (* ky_m (/ (sin th) (sin kx))))
(sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky_m) <= 1e-94) {
tmp = fabs((ky_m * (sin(th) / sin(kx))));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky_m) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky_m) <= 1d-94) then
tmp = abs((ky_m * (sin(th) / sin(kx))))
else
tmp = sin(th)
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = Math.abs((ky_m * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky_m) <= 1e-94: tmp = math.fabs((ky_m * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = abs(Float64(ky_m * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = abs((ky_m * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[Abs[N[(ky$95$m * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;\left|ky\_m \cdot \frac{\sin th}{\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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod25.1%
pow225.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square31.7%
Simplified31.7%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 82.6%
Taylor expanded in ky around 0 44.6%
associate-*l/42.2%
clear-num41.7%
Applied egg-rr41.7%
Taylor expanded in ky around 0 41.7%
*-commutative41.7%
associate-/r*43.9%
Simplified43.9%
add-sqr-sqrt25.0%
sqrt-unprod29.0%
pow229.0%
clear-num29.1%
associate-/r/29.1%
Applied egg-rr29.1%
unpow229.1%
rem-sqrt-square40.7%
associate-*l/39.0%
associate-*r/40.6%
Simplified40.6%
if 9.9999999999999996e-95 < (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 64.9%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (* (/ (sin ky_m) (hypot (sin ky_m) (sin kx))) (sin th))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * ((sin(ky_m) / hypot(sin(ky_m), sin(kx))) * sin(th));
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * ((Math.sin(ky_m) / Math.hypot(Math.sin(ky_m), Math.sin(kx))) * Math.sin(th));
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): return ky_s * ((math.sin(ky_m) / math.hypot(math.sin(ky_m), math.sin(kx))) * math.sin(th))
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) return Float64(ky_s * Float64(Float64(sin(ky_m) / hypot(sin(ky_m), sin(kx))) * sin(th))) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp = code(ky_s, kx, ky_m, th) tmp = ky_s * ((sin(ky_m) / hypot(sin(ky_m), sin(kx))) * sin(th)); end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * N[(N[(N[Sin[ky$95$m], $MachinePrecision] / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \left(\frac{\sin ky\_m}{\mathsf{hypot}\left(\sin ky\_m, \sin kx\right)} \cdot \sin th\right)
\end{array}
Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-undefine99.7%
Applied egg-rr99.7%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (* (sin ky_m) (/ (sin th) (hypot (sin ky_m) (sin kx))))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * (sin(ky_m) * (sin(th) / hypot(sin(ky_m), sin(kx))));
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * (Math.sin(ky_m) * (Math.sin(th) / Math.hypot(Math.sin(ky_m), Math.sin(kx))));
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): return ky_s * (math.sin(ky_m) * (math.sin(th) / math.hypot(math.sin(ky_m), math.sin(kx))))
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) return Float64(ky_s * Float64(sin(ky_m) * Float64(sin(th) / hypot(sin(ky_m), sin(kx))))) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp = code(ky_s, kx, ky_m, th) tmp = ky_s * (sin(ky_m) * (sin(th) / hypot(sin(ky_m), sin(kx)))); end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * N[(N[Sin[ky$95$m], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \left(\sin ky\_m \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky\_m, \sin kx\right)}\right)
\end{array}
Initial program 91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
associate-*l/90.2%
associate-/l*91.4%
+-commutative91.4%
unpow291.4%
sin-neg91.4%
sin-neg91.4%
Simplified99.6%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= th 0.0077)
(* (sin ky_m) (/ th (hypot (sin ky_m) (sin kx))))
(if (<= th 3e+84) (sin th) (* (sin th) (/ (sin ky_m) (fabs (sin kx))))))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (th <= 0.0077) {
tmp = sin(ky_m) * (th / hypot(sin(ky_m), sin(kx)));
} else if (th <= 3e+84) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky_m) / fabs(sin(kx)));
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (th <= 0.0077) {
tmp = Math.sin(ky_m) * (th / Math.hypot(Math.sin(ky_m), Math.sin(kx)));
} else if (th <= 3e+84) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky_m) / Math.abs(Math.sin(kx)));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if th <= 0.0077: tmp = math.sin(ky_m) * (th / math.hypot(math.sin(ky_m), math.sin(kx))) elif th <= 3e+84: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky_m) / math.fabs(math.sin(kx))) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (th <= 0.0077) tmp = Float64(sin(ky_m) * Float64(th / hypot(sin(ky_m), sin(kx)))); elseif (th <= 3e+84) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky_m) / abs(sin(kx)))); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (th <= 0.0077) tmp = sin(ky_m) * (th / hypot(sin(ky_m), sin(kx))); elseif (th <= 3e+84) tmp = sin(th); else tmp = sin(th) * (sin(ky_m) / abs(sin(kx))); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[th, 0.0077], N[(N[Sin[ky$95$m], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 3e+84], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky$95$m], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;th \leq 0.0077:\\
\;\;\;\;\sin ky\_m \cdot \frac{th}{\mathsf{hypot}\left(\sin ky\_m, \sin kx\right)}\\
\mathbf{elif}\;th \leq 3 \cdot 10^{+84}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky\_m}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if th < 0.0077000000000000002Initial program 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/89.6%
associate-/l*91.1%
+-commutative91.1%
unpow291.1%
sin-neg91.1%
sin-neg91.1%
Simplified99.6%
Taylor expanded in th around 0 64.5%
if 0.0077000000000000002 < th < 2.99999999999999996e84Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.5%
associate-/l*99.0%
+-commutative99.0%
unpow299.0%
sin-neg99.0%
sin-neg99.0%
Simplified99.0%
Taylor expanded in kx around 0 4.0%
if 2.99999999999999996e84 < th Initial program 91.2%
Taylor expanded in ky around 0 21.1%
add-sqr-sqrt19.6%
sqrt-prod43.3%
rem-sqrt-square49.9%
Applied egg-rr49.9%
Final simplification59.7%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(fabs (sin th))
(if (<= (sin ky_m) 1e-94) (* (sin th) (/ ky_m (sin kx))) (sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky_m) <= 1e-94) {
tmp = sin(th) * (ky_m / sin(kx));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky_m) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky_m) <= 1d-94) then
tmp = sin(th) * (ky_m / sin(kx))
else
tmp = sin(th)
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = Math.sin(th) * (ky_m / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky_m) <= 1e-94: tmp = math.sin(th) * (ky_m / math.sin(kx)) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = Float64(sin(th) * Float64(ky_m / sin(kx))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = sin(th) * (ky_m / sin(kx)); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[(N[Sin[th], $MachinePrecision] * N[(ky$95$m / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;\sin th \cdot \frac{ky\_m}{\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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod25.1%
pow225.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square31.7%
Simplified31.7%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 82.6%
Taylor expanded in ky around 0 44.6%
if 9.9999999999999996e-95 < (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 64.9%
Final simplification47.6%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= (sin ky_m) -0.02)
(fabs (sin th))
(if (<= (sin ky_m) 1e-94) (* ky_m (/ (sin th) (sin kx))) (sin th)))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (sin(ky_m) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky_m) <= 1e-94) {
tmp = ky_m * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky_m) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky_m) <= 1d-94) then
tmp = ky_m * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (Math.sin(ky_m) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky_m) <= 1e-94) {
tmp = ky_m * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if math.sin(ky_m) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky_m) <= 1e-94: tmp = ky_m * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = Float64(ky_m * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (sin(ky_m) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky_m) <= 1e-94) tmp = ky_m * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky$95$m], $MachinePrecision], 1e-94], N[(ky$95$m * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;\sin ky\_m \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky\_m \leq 10^{-94}:\\
\;\;\;\;ky\_m \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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod25.1%
pow225.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square31.7%
Simplified31.7%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-95Initial program 82.6%
unpow282.6%
sqr-neg82.6%
sin-neg82.6%
sin-neg82.6%
unpow282.6%
associate-*l/80.0%
associate-/l*82.6%
+-commutative82.6%
unpow282.6%
sin-neg82.6%
sin-neg82.6%
Simplified99.7%
Taylor expanded in ky around 0 42.2%
associate-/l*44.6%
Simplified44.6%
if 9.9999999999999996e-95 < (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 64.9%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= kx 2.1e-6)
(* (sin th) (/ (sin ky_m) (hypot (sin ky_m) kx)))
(* (sin th) (/ (sin ky_m) (fabs (sin kx)))))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 2.1e-6) {
tmp = sin(th) * (sin(ky_m) / hypot(sin(ky_m), kx));
} else {
tmp = sin(th) * (sin(ky_m) / fabs(sin(kx)));
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 2.1e-6) {
tmp = Math.sin(th) * (Math.sin(ky_m) / Math.hypot(Math.sin(ky_m), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky_m) / Math.abs(Math.sin(kx)));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if kx <= 2.1e-6: tmp = math.sin(th) * (math.sin(ky_m) / math.hypot(math.sin(ky_m), kx)) else: tmp = math.sin(th) * (math.sin(ky_m) / math.fabs(math.sin(kx))) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (kx <= 2.1e-6) tmp = Float64(sin(th) * Float64(sin(ky_m) / hypot(sin(ky_m), kx))); else tmp = Float64(sin(th) * Float64(sin(ky_m) / abs(sin(kx)))); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (kx <= 2.1e-6) tmp = sin(th) * (sin(ky_m) / hypot(sin(ky_m), kx)); else tmp = sin(th) * (sin(ky_m) / abs(sin(kx))); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[kx, 2.1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky$95$m], $MachinePrecision] / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky$95$m], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;kx \leq 2.1 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky\_m}{\mathsf{hypot}\left(\sin ky\_m, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky\_m}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 2.0999999999999998e-6Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 73.9%
if 2.0999999999999998e-6 < kx Initial program 99.6%
Taylor expanded in ky around 0 33.6%
add-sqr-sqrt24.1%
sqrt-prod61.3%
rem-sqrt-square61.3%
Applied egg-rr61.3%
Final simplification71.4%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= kx 2.1e-6)
(* (sin ky_m) (/ (sin th) (hypot (sin ky_m) kx)))
(* (sin th) (/ (sin ky_m) (fabs (sin kx)))))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 2.1e-6) {
tmp = sin(ky_m) * (sin(th) / hypot(sin(ky_m), kx));
} else {
tmp = sin(th) * (sin(ky_m) / fabs(sin(kx)));
}
return ky_s * tmp;
}
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 2.1e-6) {
tmp = Math.sin(ky_m) * (Math.sin(th) / Math.hypot(Math.sin(ky_m), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky_m) / Math.abs(Math.sin(kx)));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if kx <= 2.1e-6: tmp = math.sin(ky_m) * (math.sin(th) / math.hypot(math.sin(ky_m), kx)) else: tmp = math.sin(th) * (math.sin(ky_m) / math.fabs(math.sin(kx))) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (kx <= 2.1e-6) tmp = Float64(sin(ky_m) * Float64(sin(th) / hypot(sin(ky_m), kx))); else tmp = Float64(sin(th) * Float64(sin(ky_m) / abs(sin(kx)))); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (kx <= 2.1e-6) tmp = sin(ky_m) * (sin(th) / hypot(sin(ky_m), kx)); else tmp = sin(th) * (sin(ky_m) / abs(sin(kx))); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[kx, 2.1e-6], N[(N[Sin[ky$95$m], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky$95$m], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky$95$m], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;kx \leq 2.1 \cdot 10^{-6}:\\
\;\;\;\;\sin ky\_m \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky\_m, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky\_m}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 2.0999999999999998e-6Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/87.9%
associate-/l*89.4%
+-commutative89.4%
unpow289.4%
sin-neg89.4%
sin-neg89.4%
Simplified99.6%
Taylor expanded in kx around 0 73.8%
if 2.0999999999999998e-6 < kx Initial program 99.6%
Taylor expanded in ky around 0 33.6%
add-sqr-sqrt24.1%
sqrt-prod61.3%
rem-sqrt-square61.3%
Applied egg-rr61.3%
Final simplification71.3%
ky\_m = (fabs.f64 ky)
ky\_s = (copysign.f64 #s(literal 1 binary64) ky)
(FPCore (ky_s kx ky_m th)
:precision binary64
(*
ky_s
(if (<= ky_m 4.5e-146)
(* ky_m (/ (sin th) kx))
(if (<= ky_m 2.5e+107) (sin th) (fabs (sin th))))))ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 4.5e-146) {
tmp = ky_m * (sin(th) / kx);
} else if (ky_m <= 2.5e+107) {
tmp = sin(th);
} else {
tmp = fabs(sin(th));
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (ky_m <= 4.5d-146) then
tmp = ky_m * (sin(th) / kx)
else if (ky_m <= 2.5d+107) then
tmp = sin(th)
else
tmp = abs(sin(th))
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 4.5e-146) {
tmp = ky_m * (Math.sin(th) / kx);
} else if (ky_m <= 2.5e+107) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if ky_m <= 4.5e-146: tmp = ky_m * (math.sin(th) / kx) elif ky_m <= 2.5e+107: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (ky_m <= 4.5e-146) tmp = Float64(ky_m * Float64(sin(th) / kx)); elseif (ky_m <= 2.5e+107) tmp = sin(th); else tmp = abs(sin(th)); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (ky_m <= 4.5e-146) tmp = ky_m * (sin(th) / kx); elseif (ky_m <= 2.5e+107) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[ky$95$m, 4.5e-146], N[(ky$95$m * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky$95$m, 2.5e+107], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;ky\_m \leq 4.5 \cdot 10^{-146}:\\
\;\;\;\;ky\_m \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky\_m \leq 2.5 \cdot 10^{+107}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 4.5000000000000001e-146Initial program 87.7%
Taylor expanded in ky around 0 30.3%
associate-*l/28.6%
clear-num28.3%
Applied egg-rr28.3%
Taylor expanded in ky around 0 26.9%
*-commutative26.9%
associate-/r*28.4%
Simplified28.4%
Taylor expanded in kx around 0 20.7%
associate-/l*22.5%
Simplified22.5%
if 4.5000000000000001e-146 < ky < 2.5000000000000001e107Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 44.3%
if 2.5000000000000001e107 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 31.0%
add-sqr-sqrt6.6%
sqrt-unprod18.5%
pow218.5%
Applied egg-rr18.5%
unpow218.5%
rem-sqrt-square19.5%
Simplified19.5%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (if (<= ky_m 3.85e-146) (* ky_m (/ (sin th) kx)) (sin th))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 3.85e-146) {
tmp = ky_m * (sin(th) / kx);
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (ky_m <= 3.85d-146) then
tmp = ky_m * (sin(th) / kx)
else
tmp = sin(th)
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 3.85e-146) {
tmp = ky_m * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if ky_m <= 3.85e-146: tmp = ky_m * (math.sin(th) / kx) else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (ky_m <= 3.85e-146) tmp = Float64(ky_m * Float64(sin(th) / kx)); else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (ky_m <= 3.85e-146) tmp = ky_m * (sin(th) / kx); else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[ky$95$m, 3.85e-146], N[(ky$95$m * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;ky\_m \leq 3.85 \cdot 10^{-146}:\\
\;\;\;\;ky\_m \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.84999999999999998e-146Initial program 87.7%
Taylor expanded in ky around 0 30.3%
associate-*l/28.6%
clear-num28.3%
Applied egg-rr28.3%
Taylor expanded in ky around 0 26.9%
*-commutative26.9%
associate-/r*28.4%
Simplified28.4%
Taylor expanded in kx around 0 20.7%
associate-/l*22.5%
Simplified22.5%
if 3.84999999999999998e-146 < ky Initial 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 39.5%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (if (<= kx 1.95e-7) (sin th) (* ky_m (/ th (sin kx))))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 1.95e-7) {
tmp = sin(th);
} else {
tmp = ky_m * (th / sin(kx));
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.95d-7) then
tmp = sin(th)
else
tmp = ky_m * (th / sin(kx))
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 1.95e-7) {
tmp = Math.sin(th);
} else {
tmp = ky_m * (th / Math.sin(kx));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if kx <= 1.95e-7: tmp = math.sin(th) else: tmp = ky_m * (th / math.sin(kx)) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (kx <= 1.95e-7) tmp = sin(th); else tmp = Float64(ky_m * Float64(th / sin(kx))); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (kx <= 1.95e-7) tmp = sin(th); else tmp = ky_m * (th / sin(kx)); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[kx, 1.95e-7], N[Sin[th], $MachinePrecision], N[(ky$95$m * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;kx \leq 1.95 \cdot 10^{-7}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky\_m \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.95000000000000012e-7Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/87.9%
associate-/l*89.4%
+-commutative89.4%
unpow289.4%
sin-neg89.4%
sin-neg89.4%
Simplified99.6%
Taylor expanded in kx around 0 27.9%
if 1.95000000000000012e-7 < kx Initial program 99.6%
Taylor expanded in ky around 0 33.6%
associate-*l/33.6%
clear-num32.6%
Applied egg-rr32.6%
Taylor expanded in ky around 0 29.2%
*-commutative29.2%
associate-/r*29.2%
Simplified29.2%
Taylor expanded in th around 0 22.2%
associate-/l*22.2%
Simplified22.2%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (if (<= kx 1.2e-7) (sin th) (log (+ th 1.0)))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 1.2e-7) {
tmp = sin(th);
} else {
tmp = log((th + 1.0));
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.2d-7) then
tmp = sin(th)
else
tmp = log((th + 1.0d0))
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (kx <= 1.2e-7) {
tmp = Math.sin(th);
} else {
tmp = Math.log((th + 1.0));
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if kx <= 1.2e-7: tmp = math.sin(th) else: tmp = math.log((th + 1.0)) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (kx <= 1.2e-7) tmp = sin(th); else tmp = log(Float64(th + 1.0)); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (kx <= 1.2e-7) tmp = sin(th); else tmp = log((th + 1.0)); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[kx, 1.2e-7], N[Sin[th], $MachinePrecision], N[Log[N[(th + 1.0), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;kx \leq 1.2 \cdot 10^{-7}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\log \left(th + 1\right)\\
\end{array}
\end{array}
if kx < 1.19999999999999989e-7Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/87.9%
associate-/l*89.4%
+-commutative89.4%
unpow289.4%
sin-neg89.4%
sin-neg89.4%
Simplified99.6%
Taylor expanded in kx around 0 27.9%
if 1.19999999999999989e-7 < kx 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 7.8%
add-log-exp19.7%
Applied egg-rr19.7%
Taylor expanded in th around 0 18.0%
+-commutative18.0%
Simplified18.0%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (if (<= ky_m 1.95e-234) 0.0 (sin th))))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 1.95e-234) {
tmp = 0.0;
} else {
tmp = sin(th);
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (ky_m <= 1.95d-234) then
tmp = 0.0d0
else
tmp = sin(th)
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 1.95e-234) {
tmp = 0.0;
} else {
tmp = Math.sin(th);
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if ky_m <= 1.95e-234: tmp = 0.0 else: tmp = math.sin(th) return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (ky_m <= 1.95e-234) tmp = 0.0; else tmp = sin(th); end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (ky_m <= 1.95e-234) tmp = 0.0; else tmp = sin(th); end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[ky$95$m, 1.95e-234], 0.0, N[Sin[th], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;ky\_m \leq 1.95 \cdot 10^{-234}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.9500000000000001e-234Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/87.9%
associate-/l*89.9%
+-commutative89.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
Simplified99.7%
Taylor expanded in kx around 0 15.8%
add-log-exp20.1%
Applied egg-rr20.1%
Taylor expanded in th around 0 15.3%
metadata-eval15.3%
Applied egg-rr15.3%
if 1.9500000000000001e-234 < ky Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/93.6%
associate-/l*93.5%
+-commutative93.5%
unpow293.5%
sin-neg93.5%
sin-neg93.5%
Simplified99.5%
Taylor expanded in kx around 0 35.4%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s (if (<= ky_m 4.6e-183) 0.0 th)))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 4.6e-183) {
tmp = 0.0;
} else {
tmp = th;
}
return ky_s * tmp;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
real(8) :: tmp
if (ky_m <= 4.6d-183) then
tmp = 0.0d0
else
tmp = th
end if
code = ky_s * tmp
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
double tmp;
if (ky_m <= 4.6e-183) {
tmp = 0.0;
} else {
tmp = th;
}
return ky_s * tmp;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): tmp = 0 if ky_m <= 4.6e-183: tmp = 0.0 else: tmp = th return ky_s * tmp
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) tmp = 0.0 if (ky_m <= 4.6e-183) tmp = 0.0; else tmp = th; end return Float64(ky_s * tmp) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp_2 = code(ky_s, kx, ky_m, th) tmp = 0.0; if (ky_m <= 4.6e-183) tmp = 0.0; else tmp = th; end tmp_2 = ky_s * tmp; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * If[LessEqual[ky$95$m, 4.6e-183], 0.0, th]), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot \begin{array}{l}
\mathbf{if}\;ky\_m \leq 4.6 \cdot 10^{-183}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 4.60000000000000032e-183Initial program 88.4%
unpow288.4%
sqr-neg88.4%
sin-neg88.4%
sin-neg88.4%
unpow288.4%
associate-*l/86.4%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.6%
Taylor expanded in kx around 0 16.1%
add-log-exp20.3%
Applied egg-rr20.3%
Taylor expanded in th around 0 14.7%
metadata-eval14.7%
Applied egg-rr14.7%
if 4.60000000000000032e-183 < ky Initial program 97.1%
unpow297.1%
sqr-neg97.1%
sin-neg97.1%
sin-neg97.1%
unpow297.1%
associate-*l/97.0%
associate-/l*96.9%
+-commutative96.9%
unpow296.9%
sin-neg96.9%
sin-neg96.9%
Simplified99.5%
Taylor expanded in kx around 0 37.5%
Taylor expanded in th around 0 21.1%
ky\_m = (fabs.f64 ky) ky\_s = (copysign.f64 #s(literal 1 binary64) ky) (FPCore (ky_s kx ky_m th) :precision binary64 (* ky_s 0.0))
ky\_m = fabs(ky);
ky\_s = copysign(1.0, ky);
double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * 0.0;
}
ky\_m = abs(ky)
ky\_s = copysign(1.0d0, ky)
real(8) function code(ky_s, kx, ky_m, th)
real(8), intent (in) :: ky_s
real(8), intent (in) :: kx
real(8), intent (in) :: ky_m
real(8), intent (in) :: th
code = ky_s * 0.0d0
end function
ky\_m = Math.abs(ky);
ky\_s = Math.copySign(1.0, ky);
public static double code(double ky_s, double kx, double ky_m, double th) {
return ky_s * 0.0;
}
ky\_m = math.fabs(ky) ky\_s = math.copysign(1.0, ky) def code(ky_s, kx, ky_m, th): return ky_s * 0.0
ky\_m = abs(ky) ky\_s = copysign(1.0, ky) function code(ky_s, kx, ky_m, th) return Float64(ky_s * 0.0) end
ky\_m = abs(ky); ky\_s = sign(ky) * abs(1.0); function tmp = code(ky_s, kx, ky_m, th) tmp = ky_s * 0.0; end
ky\_m = N[Abs[ky], $MachinePrecision]
ky\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[ky$95$s_, kx_, ky$95$m_, th_] := N[(ky$95$s * 0.0), $MachinePrecision]
\begin{array}{l}
ky\_m = \left|ky\right|
\\
ky\_s = \mathsf{copysign}\left(1, ky\right)
\\
ky\_s \cdot 0
\end{array}
Initial program 91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
associate-*l/90.2%
associate-/l*91.4%
+-commutative91.4%
unpow291.4%
sin-neg91.4%
sin-neg91.4%
Simplified99.6%
Taylor expanded in kx around 0 23.9%
add-log-exp20.9%
Applied egg-rr20.9%
Taylor expanded in th around 0 11.3%
metadata-eval11.3%
Applied egg-rr11.3%
herbie shell --seed 2024165
(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)))