
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(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) 1e-212)
t_1
(if (<= (sin ky) 1e-64) (fabs 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) <= 1e-212) {
tmp = t_1;
} else if (sin(ky) <= 1e-64) {
tmp = fabs(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) <= 1d-212) then
tmp = t_1
else if (sin(ky) <= 1d-64) then
tmp = abs(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) <= 1e-212) {
tmp = t_1;
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs(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) <= 1e-212: tmp = t_1 elif math.sin(ky) <= 1e-64: tmp = math.fabs(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) <= 1e-212) tmp = t_1; elseif (sin(ky) <= 1e-64) tmp = abs(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) <= 1e-212) tmp = t_1; elseif (sin(ky) <= 1e-64) tmp = abs(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], 1e-212], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[t$95$1], $MachinePrecision], 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 10^{-212}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|t\_1\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.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod24.7%
pow224.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square30.4%
associate-*r/30.5%
associate-*l/30.5%
*-inverses30.5%
*-lft-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999954e-213Initial program 83.3%
unpow283.3%
sqr-neg83.3%
sin-neg83.3%
sin-neg83.3%
unpow283.3%
associate-*l/78.9%
associate-/l*83.2%
unpow283.2%
Simplified99.6%
Taylor expanded in ky around 0 47.5%
associate-/l*50.8%
Simplified50.8%
if 9.99999999999999954e-213 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 96.4%
unpow296.4%
sqr-neg96.4%
sin-neg96.4%
sin-neg96.4%
unpow296.4%
associate-*l/83.6%
associate-/l*96.3%
unpow296.3%
Simplified99.7%
Taylor expanded in ky around 0 29.6%
clear-num29.6%
associate-/r/29.6%
Applied egg-rr29.6%
add-sqr-sqrt28.7%
sqrt-unprod39.8%
pow239.8%
associate-*l/39.8%
*-un-lft-identity39.8%
*-commutative39.8%
associate-/l*39.9%
Applied egg-rr39.9%
unpow239.9%
rem-sqrt-square55.3%
associate-*r/52.3%
*-commutative52.3%
associate-/l*55.2%
Simplified55.2%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification48.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 2e-196)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-64) (fabs (* (sin th) (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-196) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-64) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-196) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-64) then
tmp = abs((sin(th) * (ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-196) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-196: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-64: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-196) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-64) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-196) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-64) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-196], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-196}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod24.7%
pow224.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square30.4%
associate-*r/30.5%
associate-*l/30.5%
*-inverses30.5%
*-lft-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 2.0000000000000001e-196Initial program 82.9%
unpow282.9%
sqr-neg82.9%
sin-neg82.9%
sin-neg82.9%
unpow282.9%
associate-*l/77.6%
associate-/l*82.9%
unpow282.9%
Simplified99.6%
Taylor expanded in ky around 0 45.6%
associate-/l*49.7%
Simplified49.7%
if 2.0000000000000001e-196 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt32.6%
sqrt-unprod41.5%
pow241.5%
associate-/l*41.7%
Applied egg-rr41.7%
unpow241.7%
rem-sqrt-square55.7%
*-commutative55.7%
associate-*l/55.9%
associate-*r/55.8%
Simplified55.8%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification48.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-196)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-64) (fabs (* (sin th) (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-196) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-64) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 2d-196) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-64) then
tmp = abs((sin(th) * (ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-196) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-196: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-64: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-196) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-64) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-196) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-64) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-196], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-196}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt0.0%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Taylor expanded in th around 0 34.1%
*-commutative34.1%
associate-/l*34.1%
Simplified34.1%
if -0.0200000000000000004 < (sin.f64 ky) < 2.0000000000000001e-196Initial program 82.9%
unpow282.9%
sqr-neg82.9%
sin-neg82.9%
sin-neg82.9%
unpow282.9%
associate-*l/77.6%
associate-/l*82.9%
unpow282.9%
Simplified99.6%
Taylor expanded in ky around 0 45.6%
associate-/l*49.7%
Simplified49.7%
if 2.0000000000000001e-196 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt32.6%
sqrt-unprod41.5%
pow241.5%
associate-/l*41.7%
Applied egg-rr41.7%
unpow241.7%
rem-sqrt-square55.7%
*-commutative55.7%
associate-*l/55.9%
associate-*r/55.8%
Simplified55.8%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification49.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-196)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-64) (fabs (* (sin th) (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-196) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-64) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 2d-196) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-64) then
tmp = abs((sin(th) * (ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-196) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-196: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-64: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-196) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-64) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-196) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-64) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-196], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-196}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt0.0%
sqrt-prod64.7%
rem-sqrt-square64.7%
Applied egg-rr64.7%
Taylor expanded in th around 0 34.5%
*-commutative34.5%
associate-/l*34.6%
Simplified34.6%
if -0.050000000000000003 < (sin.f64 ky) < 2.0000000000000001e-196Initial program 83.1%
unpow283.1%
sqr-neg83.1%
sin-neg83.1%
sin-neg83.1%
unpow283.1%
associate-*l/77.8%
associate-/l*83.0%
unpow283.0%
Simplified99.6%
Taylor expanded in ky around 0 49.5%
if 2.0000000000000001e-196 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt32.6%
sqrt-unprod41.5%
pow241.5%
associate-/l*41.7%
Applied egg-rr41.7%
unpow241.7%
rem-sqrt-square55.7%
*-commutative55.7%
associate-*l/55.9%
associate-*r/55.8%
Simplified55.8%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification49.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-196)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= (sin ky) 1e-64) (fabs (* (sin th) (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-196) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 1e-64) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 2d-196) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 1d-64) then
tmp = abs((sin(th) * (ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-196) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-196: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 1e-64: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-196) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 1e-64) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-196) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 1e-64) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-196], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-196}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt0.0%
sqrt-prod64.7%
rem-sqrt-square64.7%
Applied egg-rr64.7%
Taylor expanded in th around 0 34.5%
*-commutative34.5%
associate-/l*34.6%
Simplified34.6%
if -0.050000000000000003 < (sin.f64 ky) < 2.0000000000000001e-196Initial program 83.1%
unpow283.1%
sqr-neg83.1%
sin-neg83.1%
sin-neg83.1%
unpow283.1%
associate-*l/77.8%
associate-/l*83.0%
unpow283.0%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 49.5%
if 2.0000000000000001e-196 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt32.6%
sqrt-unprod41.5%
pow241.5%
associate-/l*41.7%
Applied egg-rr41.7%
unpow241.7%
rem-sqrt-square55.7%
*-commutative55.7%
associate-*l/55.9%
associate-*r/55.8%
Simplified55.8%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification49.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-196)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= (sin ky) 1e-64)
(fabs (* (sin th) (/ ky (sin kx))))
(/ (* (sin ky) (sin th)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-196) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 1e-64) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else {
tmp = (sin(ky) * sin(th)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 2d-196) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 1d-64) then
tmp = abs((sin(th) * (ky / sin(kx))))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-196) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-196: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 1e-64: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-196) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 1e-64) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-196) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 1e-64) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-196], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-196}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt0.0%
sqrt-prod64.7%
rem-sqrt-square64.7%
Applied egg-rr64.7%
Taylor expanded in th around 0 34.5%
*-commutative34.5%
associate-/l*34.6%
Simplified34.6%
if -0.050000000000000003 < (sin.f64 ky) < 2.0000000000000001e-196Initial program 83.1%
unpow283.1%
sqr-neg83.1%
sin-neg83.1%
sin-neg83.1%
unpow283.1%
associate-*l/77.8%
associate-/l*83.0%
unpow283.0%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 49.5%
if 2.0000000000000001e-196 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt32.6%
sqrt-unprod41.5%
pow241.5%
associate-/l*41.7%
Applied egg-rr41.7%
unpow241.7%
rem-sqrt-square55.7%
*-commutative55.7%
associate-*l/55.9%
associate-*r/55.8%
Simplified55.8%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.2%
associate-*r/61.2%
Applied egg-rr61.2%
Final simplification49.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 1e-64)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(/ (* (sin ky) (sin th)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 1e-64) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 1d-64) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-64) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 1e-64: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 1e-64) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 1e-64) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-64], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 10^{-64}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\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.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt0.0%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Taylor expanded in th around 0 34.1%
*-commutative34.1%
associate-/l*34.1%
Simplified34.1%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999965e-65Initial program 86.7%
+-commutative86.7%
unpow286.7%
unpow286.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.8%
add-sqr-sqrt19.1%
sqrt-unprod38.4%
pow238.4%
Applied egg-rr38.4%
unpow238.4%
rem-sqrt-square48.2%
Simplified48.2%
if 9.99999999999999965e-65 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.2%
associate-*r/61.2%
Applied egg-rr61.2%
Final simplification48.0%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/90.9%
associate-/l*93.8%
unpow293.8%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin ky))))
(if (<= ky 3.1e-10)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(if (<= ky 1.5e+60)
(* (sin ky) (/ (sin th) t_1))
(if (<= ky 1.05e+210)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(/ (* (sin ky) (sin th)) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(ky));
double tmp;
if (ky <= 3.1e-10) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else if (ky <= 1.5e+60) {
tmp = sin(ky) * (sin(th) / t_1);
} else if (ky <= 1.05e+210) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = (sin(ky) * sin(th)) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(ky));
double tmp;
if (ky <= 3.1e-10) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 1.5e+60) {
tmp = Math.sin(ky) * (Math.sin(th) / t_1);
} else if (ky <= 1.05e+210) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(ky)) tmp = 0 if ky <= 3.1e-10: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) elif ky <= 1.5e+60: tmp = math.sin(ky) * (math.sin(th) / t_1) elif ky <= 1.05e+210: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = (math.sin(ky) * math.sin(th)) / t_1 return tmp
function code(kx, ky, th) t_1 = abs(sin(ky)) tmp = 0.0 if (ky <= 3.1e-10) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); elseif (ky <= 1.5e+60) tmp = Float64(sin(ky) * Float64(sin(th) / t_1)); elseif (ky <= 1.05e+210) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(Float64(sin(ky) * sin(th)) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(ky)); tmp = 0.0; if (ky <= 3.1e-10) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); elseif (ky <= 1.5e+60) tmp = sin(ky) * (sin(th) / t_1); elseif (ky <= 1.05e+210) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = (sin(ky) * sin(th)) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, 3.1e-10], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.5e+60], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.05e+210], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin ky\right|\\
\mathbf{if}\;ky \leq 3.1 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{+60}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t\_1}\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{+210}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{t\_1}\\
\end{array}
\end{array}
if ky < 3.10000000000000015e-10Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 66.6%
if 3.10000000000000015e-10 < ky < 1.4999999999999999e60Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.7%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in kx around 0 47.0%
add-sqr-sqrt45.2%
sqrt-prod71.5%
rem-sqrt-square71.5%
Applied egg-rr71.5%
if 1.4999999999999999e60 < ky < 1.0499999999999999e210Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 63.2%
associate-*l/63.5%
+-commutative63.5%
unpow263.5%
unpow263.5%
hypot-undefine63.5%
*-lft-identity63.5%
hypot-undefine63.5%
unpow263.5%
unpow263.5%
+-commutative63.5%
unpow263.5%
unpow263.5%
hypot-define63.5%
Simplified63.5%
if 1.0499999999999999e210 < 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.2%
unpow299.2%
Simplified99.2%
Taylor expanded in kx around 0 29.2%
add-sqr-sqrt27.8%
sqrt-prod66.6%
rem-sqrt-square66.6%
Applied egg-rr66.6%
Taylor expanded in ky around inf 66.8%
Final simplification66.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-67) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-67) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-67) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-67) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-67: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-67) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-67) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-67], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-67}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod24.7%
pow224.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square30.4%
associate-*r/30.5%
associate-*l/30.5%
*-inverses30.5%
*-lft-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999943e-68Initial program 86.7%
unpow286.7%
sqr-neg86.7%
sin-neg86.7%
sin-neg86.7%
unpow286.7%
associate-*l/80.1%
associate-/l*86.6%
unpow286.6%
Simplified99.6%
Taylor expanded in ky around 0 42.8%
associate-/l*46.8%
Simplified46.8%
if 9.99999999999999943e-68 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification46.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-67) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-67) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-67) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-67) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-67: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-67) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-67) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-67], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-67}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\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.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod24.7%
pow224.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square30.4%
associate-*r/30.5%
associate-*l/30.5%
*-inverses30.5%
*-lft-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999943e-68Initial program 86.7%
+-commutative86.7%
unpow286.7%
unpow286.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.8%
if 9.99999999999999943e-68 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 61.3%
Final simplification46.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.1e-10) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-10) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-10) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.1e-10: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.1e-10) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.1e-10) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.1e-10], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.1 \cdot 10^{-10}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 3.10000000000000015e-10Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.0%
associate-/l*91.9%
unpow291.9%
Simplified99.6%
Taylor expanded in ky around 0 66.5%
if 3.10000000000000015e-10 < 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%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 30.2%
add-sqr-sqrt28.3%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Final simplification65.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.1e-10) (* (sin th) (/ (sin ky) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-10) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-10) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.1e-10: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.1e-10) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.1e-10) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.1e-10], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.1 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 3.10000000000000015e-10Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 66.6%
if 3.10000000000000015e-10 < 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%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 30.2%
add-sqr-sqrt28.3%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Final simplification65.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.7e-64) (* (sin th) (fabs (/ (sin ky) (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.7e-64) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.7d-64) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.7e-64) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.7e-64: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.7e-64) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.7e-64) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.7e-64], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.7 \cdot 10^{-64}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 1.70000000000000006e-64Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 32.1%
add-sqr-sqrt13.0%
sqrt-unprod26.7%
pow226.7%
Applied egg-rr26.7%
unpow226.7%
rem-sqrt-square33.0%
Simplified33.0%
if 1.70000000000000006e-64 < 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%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 34.7%
add-sqr-sqrt33.1%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Final simplification41.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.8e-64) (* (sin th) (fabs (/ (sin ky) (sin kx)))) (/ (* (sin ky) (sin th)) (fabs (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-64) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / fabs(sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.8d-64) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = (sin(ky) * sin(th)) / abs(sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-64) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.abs(Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.8e-64: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.fabs(math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.8e-64) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / abs(sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.8e-64) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = (sin(ky) * sin(th)) / abs(sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.8e-64], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.8 \cdot 10^{-64}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2.80000000000000004e-64Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 32.1%
add-sqr-sqrt13.0%
sqrt-unprod26.7%
pow226.7%
Applied egg-rr26.7%
unpow226.7%
rem-sqrt-square33.0%
Simplified33.0%
if 2.80000000000000004e-64 < 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%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 34.7%
add-sqr-sqrt33.1%
sqrt-prod64.0%
rem-sqrt-square64.0%
Applied egg-rr64.0%
Taylor expanded in ky around inf 64.0%
Final simplification42.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 4.2e-130)
(* ky (/ (sin th) kx))
(if (<= ky 2e-82)
(sin th)
(if (<= ky 6.6e-68)
(/ (* ky th) (sin kx))
(if (or (<= ky 9.2e+144) (not (<= ky 1.26e+262)))
(fabs (sin th))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-130) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 2e-82) {
tmp = sin(th);
} else if (ky <= 6.6e-68) {
tmp = (ky * th) / sin(kx);
} else if ((ky <= 9.2e+144) || !(ky <= 1.26e+262)) {
tmp = fabs(sin(th));
} 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 <= 4.2d-130) then
tmp = ky * (sin(th) / kx)
else if (ky <= 2d-82) then
tmp = sin(th)
else if (ky <= 6.6d-68) then
tmp = (ky * th) / sin(kx)
else if ((ky <= 9.2d+144) .or. (.not. (ky <= 1.26d+262))) then
tmp = abs(sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-130) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 2e-82) {
tmp = Math.sin(th);
} else if (ky <= 6.6e-68) {
tmp = (ky * th) / Math.sin(kx);
} else if ((ky <= 9.2e+144) || !(ky <= 1.26e+262)) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.2e-130: tmp = ky * (math.sin(th) / kx) elif ky <= 2e-82: tmp = math.sin(th) elif ky <= 6.6e-68: tmp = (ky * th) / math.sin(kx) elif (ky <= 9.2e+144) or not (ky <= 1.26e+262): tmp = math.fabs(math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.2e-130) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 2e-82) tmp = sin(th); elseif (ky <= 6.6e-68) tmp = Float64(Float64(ky * th) / sin(kx)); elseif ((ky <= 9.2e+144) || !(ky <= 1.26e+262)) tmp = abs(sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.2e-130) tmp = ky * (sin(th) / kx); elseif (ky <= 2e-82) tmp = sin(th); elseif (ky <= 6.6e-68) tmp = (ky * th) / sin(kx); elseif ((ky <= 9.2e+144) || ~((ky <= 1.26e+262))) tmp = abs(sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.2e-130], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2e-82], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 6.6e-68], N[(N[(ky * th), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 9.2e+144], N[Not[LessEqual[ky, 1.26e+262]], $MachinePrecision]], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.2 \cdot 10^{-130}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 2 \cdot 10^{-82}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 6.6 \cdot 10^{-68}:\\
\;\;\;\;\frac{ky \cdot th}{\sin kx}\\
\mathbf{elif}\;ky \leq 9.2 \cdot 10^{+144} \lor \neg \left(ky \leq 1.26 \cdot 10^{+262}\right):\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.20000000000000004e-130Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/87.7%
associate-/l*90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in ky around 0 28.3%
Taylor expanded in kx around 0 19.5%
associate-/l*21.8%
Simplified21.8%
if 4.20000000000000004e-130 < ky < 2e-82 or 9.2000000000000006e144 < ky < 1.26000000000000004e262Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/92.1%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in kx around 0 32.0%
if 2e-82 < ky < 6.5999999999999997e-68Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.6%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in ky around 0 2.5%
Taylor expanded in th around 0 2.1%
*-commutative2.1%
Simplified2.1%
if 6.5999999999999997e-68 < ky < 9.2000000000000006e144 or 1.26000000000000004e262 < 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.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 40.3%
add-sqr-sqrt21.9%
sqrt-unprod25.4%
pow225.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square37.0%
associate-*r/37.0%
associate-*l/37.0%
*-inverses37.0%
*-lft-identity37.0%
Simplified37.0%
Final simplification26.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.6e-68) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.6e-68) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 6.6d-68) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.6e-68) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.6e-68: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.6e-68) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6.6e-68) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.6e-68], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.6 \cdot 10^{-68}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.5999999999999997e-68Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/87.4%
associate-/l*91.5%
unpow291.5%
Simplified99.6%
Taylor expanded in ky around 0 28.1%
Taylor expanded in th around 0 16.3%
associate-/l*18.8%
Simplified18.8%
if 6.5999999999999997e-68 < 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%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 34.8%
Final simplification23.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7e-130) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7e-130) {
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 <= 7d-130) 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 <= 7e-130) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7e-130: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7e-130) 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 <= 7e-130) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7e-130], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7 \cdot 10^{-130}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.9999999999999998e-130Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/87.7%
associate-/l*90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in ky around 0 28.3%
Taylor expanded in kx around 0 19.5%
associate-/l*21.8%
Simplified21.8%
if 6.9999999999999998e-130 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/96.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.5%
Final simplification26.7%
(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 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/90.9%
associate-/l*93.8%
unpow293.8%
Simplified99.6%
Taylor expanded in kx around 0 23.7%
Final simplification23.7%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/90.9%
associate-/l*93.8%
unpow293.8%
Simplified99.6%
Taylor expanded in kx around 0 23.7%
Taylor expanded in th around 0 16.0%
Final simplification16.0%
herbie shell --seed 2024067
(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)))