
(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 19 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 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-17)
(fabs (sin th))
(if (<= (sin ky) -4e-305)
(/ (sin th) (/ (sin kx) ky))
(if (<= (sin ky) 1e-18)
(/ (fabs (/ ky (sin kx))) (/ 1.0 (sin th)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-305) {
tmp = sin(th) / (sin(kx) / ky);
} else if (sin(ky) <= 1e-18) {
tmp = fabs((ky / sin(kx))) / (1.0 / 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 (sin(ky) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-4d-305)) then
tmp = sin(th) / (sin(kx) / ky)
else if (sin(ky) <= 1d-18) then
tmp = abs((ky / sin(kx))) / (1.0d0 / 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 (Math.sin(ky) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-305) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(ky) <= 1e-18) {
tmp = Math.abs((ky / Math.sin(kx))) / (1.0 / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-305: tmp = math.sin(th) / (math.sin(kx) / ky) elif math.sin(ky) <= 1e-18: tmp = math.fabs((ky / math.sin(kx))) / (1.0 / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-305) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (sin(ky) <= 1e-18) tmp = Float64(abs(Float64(ky / sin(kx))) / Float64(1.0 / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-305) tmp = sin(th) / (sin(kx) / ky); elseif (sin(ky) <= 1e-18) tmp = abs((ky / sin(kx))) / (1.0 / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-305], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-305}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;\frac{\left|\frac{ky}{\sin kx}\right|}{\frac{1}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < -3.99999999999999999e-305Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.3%
*-commutative58.3%
associate-/l*59.2%
Simplified59.2%
if -3.99999999999999999e-305 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 85.4%
+-commutative85.4%
unpow285.4%
unpow285.4%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.8%
hypot-udef85.4%
unpow285.4%
unpow285.4%
+-commutative85.4%
unpow285.4%
unpow285.4%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 57.1%
add-sqr-sqrt50.0%
sqrt-unprod65.5%
pow265.5%
Applied egg-rr65.5%
unpow265.5%
rem-sqrt-square84.3%
Simplified84.3%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification57.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.15)
(fabs (sin th))
(if (<= (sin ky) 1e-18)
(* ky (/ (sin th) (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-18) {
tmp = ky * (sin(th) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.15) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-18) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.15: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-18: tmp = ky * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.15) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-18) tmp = Float64(ky * Float64(sin(th) / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.15) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-18) tmp = ky * (sin(th) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.15:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod26.3%
pow226.3%
Applied egg-rr26.3%
unpow226.3%
rem-sqrt-square30.9%
Simplified30.9%
if -0.149999999999999994 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 88.6%
associate-*l/85.0%
+-commutative85.0%
unpow285.0%
unpow285.0%
hypot-def91.6%
Simplified91.6%
Taylor expanded in ky around 0 89.3%
expm1-log1p-u89.2%
expm1-udef37.1%
div-inv37.1%
associate-*l*37.2%
hypot-udef33.7%
+-commutative33.7%
hypot-udef37.2%
div-inv37.2%
Applied egg-rr37.2%
expm1-def97.2%
expm1-log1p97.3%
Simplified97.3%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification71.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= (sin ky) 1e-18)
(* ky (/ (sin th) (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (sin(ky) <= 1e-18) {
tmp = ky * (sin(th) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (Math.sin(ky) <= 1e-18) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif math.sin(ky) <= 1e-18: tmp = ky * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (sin(ky) <= 1e-18) tmp = Float64(ky * Float64(sin(th) / hypot(sin(kx), sin(ky)))); 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) / hypot(sin(ky), sin(kx))) * th; elseif (sin(ky) <= 1e-18) tmp = ky * (sin(th) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 47.2%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 88.3%
associate-*l/84.6%
+-commutative84.6%
unpow284.6%
unpow284.6%
hypot-def91.4%
Simplified91.4%
Taylor expanded in ky around 0 91.4%
expm1-log1p-u91.4%
expm1-udef38.1%
div-inv38.0%
associate-*l*38.1%
hypot-udef34.5%
+-commutative34.5%
hypot-udef38.1%
div-inv38.1%
Applied egg-rr38.1%
expm1-def99.7%
expm1-log1p99.7%
Simplified99.7%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(/
(sin ky)
(* (hypot (sin ky) (sin kx)) (+ (* th 0.16666666666666666) (/ 1.0 th))))
(if (<= (sin ky) 1e-18)
(* ky (/ (sin th) (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (sin(ky) <= 1e-18) {
tmp = ky * (sin(th) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (Math.sin(ky) <= 1e-18) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) * ((th * 0.16666666666666666) + (1.0 / th))) elif math.sin(ky) <= 1e-18: tmp = ky * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) 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(hypot(sin(ky), sin(kx)) * Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th)))); elseif (sin(ky) <= 1e-18) tmp = Float64(ky * Float64(sin(th) / hypot(sin(kx), sin(ky)))); 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) / (hypot(sin(ky), sin(kx)) * ((th * 0.16666666666666666) + (1.0 / th))); elseif (sin(ky) <= 1e-18) tmp = ky * (sin(th) / hypot(sin(kx), sin(ky))); 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[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(th \cdot 0.16666666666666666 + \frac{1}{th}\right)}\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in th around 0 47.3%
+-commutative47.3%
*-commutative47.3%
unpow247.3%
unpow247.3%
hypot-def47.3%
associate-*r/47.5%
*-commutative47.5%
associate-*l/47.3%
associate-*r*47.3%
Simplified47.3%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 88.3%
associate-*l/84.6%
+-commutative84.6%
unpow284.6%
unpow284.6%
hypot-def91.4%
Simplified91.4%
Taylor expanded in ky around 0 91.4%
expm1-log1p-u91.4%
expm1-udef38.1%
div-inv38.0%
associate-*l*38.1%
hypot-udef34.5%
+-commutative34.5%
hypot-udef38.1%
div-inv38.1%
Applied egg-rr38.1%
expm1-def99.7%
expm1-log1p99.7%
Simplified99.7%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin kx) (sin ky))))
(if (<= (sin ky) -0.02)
(/ (/ (sin ky) t_1) (+ (* th 0.16666666666666666) (/ 1.0 th)))
(if (<= (sin ky) 1e-18) (* ky (/ (sin th) t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double tmp;
if (sin(ky) <= -0.02) {
tmp = (sin(ky) / t_1) / ((th * 0.16666666666666666) + (1.0 / th));
} else if (sin(ky) <= 1e-18) {
tmp = ky * (sin(th) / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = (Math.sin(ky) / t_1) / ((th * 0.16666666666666666) + (1.0 / th));
} else if (Math.sin(ky) <= 1e-18) {
tmp = ky * (Math.sin(th) / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if math.sin(ky) <= -0.02: tmp = (math.sin(ky) / t_1) / ((th * 0.16666666666666666) + (1.0 / th)) elif math.sin(ky) <= 1e-18: tmp = ky * (math.sin(th) / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))); elseif (sin(ky) <= 1e-18) tmp = Float64(ky * Float64(sin(th) / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = (sin(ky) / t_1) / ((th * 0.16666666666666666) + (1.0 / th)); elseif (sin(ky) <= 1e-18) tmp = ky * (sin(th) / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(ky * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{th \cdot 0.16666666666666666 + \frac{1}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;ky \cdot \frac{\sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.3%
associate-/r*99.4%
hypot-udef99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 47.4%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 88.3%
associate-*l/84.6%
+-commutative84.6%
unpow284.6%
unpow284.6%
hypot-def91.4%
Simplified91.4%
Taylor expanded in ky around 0 91.4%
expm1-log1p-u91.4%
expm1-udef38.1%
div-inv38.0%
associate-*l*38.1%
hypot-udef34.5%
+-commutative34.5%
hypot-udef38.1%
div-inv38.1%
Applied egg-rr38.1%
expm1-def99.7%
expm1-log1p99.7%
Simplified99.7%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-65)
(fabs (sin th))
(if (<= (sin ky) 1e-146)
(/ (/ ky kx) (/ 1.0 (sin th)))
(if (<= (sin ky) 1e-74)
(sin th)
(if (<= (sin ky) 5e-32)
(/ (/ ky (sin kx)) (+ (* th 0.16666666666666666) (/ 1.0 th)))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-65) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-146) {
tmp = (ky / kx) / (1.0 / sin(th));
} else if (sin(ky) <= 1e-74) {
tmp = sin(th);
} else if (sin(ky) <= 5e-32) {
tmp = (ky / sin(kx)) / ((th * 0.16666666666666666) + (1.0 / 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 (sin(ky) <= (-1d-65)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-146) then
tmp = (ky / kx) / (1.0d0 / sin(th))
else if (sin(ky) <= 1d-74) then
tmp = sin(th)
else if (sin(ky) <= 5d-32) then
tmp = (ky / sin(kx)) / ((th * 0.16666666666666666d0) + (1.0d0 / th))
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) <= -1e-65) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-146) {
tmp = (ky / kx) / (1.0 / Math.sin(th));
} else if (Math.sin(ky) <= 1e-74) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 5e-32) {
tmp = (ky / Math.sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-65: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-146: tmp = (ky / kx) / (1.0 / math.sin(th)) elif math.sin(ky) <= 1e-74: tmp = math.sin(th) elif math.sin(ky) <= 5e-32: tmp = (ky / math.sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-65) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-146) tmp = Float64(Float64(ky / kx) / Float64(1.0 / sin(th))); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = Float64(Float64(ky / sin(kx)) / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-65) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-146) tmp = (ky / kx) / (1.0 / sin(th)); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = (ky / sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-65], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-146], N[(N[(ky / kx), $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-74], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-65}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-146}:\\
\;\;\;\;\frac{\frac{ky}{kx}}{\frac{1}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{ky}{\sin kx}}{th \cdot 0.16666666666666666 + \frac{1}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999923e-66Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.4%
sqrt-unprod28.3%
pow228.3%
Applied egg-rr28.3%
unpow228.3%
rem-sqrt-square31.0%
Simplified31.0%
if -9.99999999999999923e-66 < (sin.f64 ky) < 1.00000000000000003e-146Initial program 84.4%
+-commutative84.4%
unpow284.4%
unpow284.4%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.6%
hypot-udef84.4%
unpow284.4%
unpow284.4%
+-commutative84.4%
unpow284.4%
unpow284.4%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 63.7%
Taylor expanded in kx around 0 45.3%
if 1.00000000000000003e-146 < (sin.f64 ky) < 9.99999999999999958e-75 or 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.7%
if 9.99999999999999958e-75 < (sin.f64 ky) < 5e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.6%
associate-/r*99.8%
hypot-udef99.8%
unpow299.8%
unpow299.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 72.3%
Taylor expanded in th around 0 44.9%
Final simplification46.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 1e-146)
(/ (/ ky kx) (/ 1.0 (sin th)))
(if (<= (sin ky) 1e-74)
(sin th)
(if (<= (sin ky) 5e-32)
(/ (/ ky (sin kx)) (+ (* th 0.16666666666666666) (/ 1.0 th)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-146) {
tmp = (ky / kx) / (1.0 / sin(th));
} else if (sin(ky) <= 1e-74) {
tmp = sin(th);
} else if (sin(ky) <= 5e-32) {
tmp = (ky / sin(kx)) / ((th * 0.16666666666666666) + (1.0 / 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 (sin(ky) <= 1d-146) then
tmp = (ky / kx) / (1.0d0 / sin(th))
else if (sin(ky) <= 1d-74) then
tmp = sin(th)
else if (sin(ky) <= 5d-32) then
tmp = (ky / sin(kx)) / ((th * 0.16666666666666666d0) + (1.0d0 / th))
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) <= 1e-146) {
tmp = (ky / kx) / (1.0 / Math.sin(th));
} else if (Math.sin(ky) <= 1e-74) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 5e-32) {
tmp = (ky / Math.sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-146: tmp = (ky / kx) / (1.0 / math.sin(th)) elif math.sin(ky) <= 1e-74: tmp = math.sin(th) elif math.sin(ky) <= 5e-32: tmp = (ky / math.sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-146) tmp = Float64(Float64(ky / kx) / Float64(1.0 / sin(th))); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = Float64(Float64(ky / sin(kx)) / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-146) tmp = (ky / kx) / (1.0 / sin(th)); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = (ky / sin(kx)) / ((th * 0.16666666666666666) + (1.0 / th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-146], N[(N[(ky / kx), $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-74], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-146}:\\
\;\;\;\;\frac{\frac{ky}{kx}}{\frac{1}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{ky}{\sin kx}}{th \cdot 0.16666666666666666 + \frac{1}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000003e-146Initial program 91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
hypot-udef91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 36.7%
Taylor expanded in kx around 0 25.9%
if 1.00000000000000003e-146 < (sin.f64 ky) < 9.99999999999999958e-75 or 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.7%
if 9.99999999999999958e-75 < (sin.f64 ky) < 5e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.6%
associate-/r*99.8%
hypot-udef99.8%
unpow299.8%
unpow299.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 72.3%
Taylor expanded in th around 0 44.9%
Final simplification38.1%
(FPCore (kx ky th)
:precision binary64
(if (or (<= th -2.26e-7) (not (<= th 4.6e+25)))
(/
(sin th)
(* (hypot (sin kx) (sin ky)) (+ (* ky 0.16666666666666666) (/ 1.0 ky))))
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((th <= -2.26e-7) || !(th <= 4.6e+25)) {
tmp = sin(th) / (hypot(sin(kx), sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((th <= -2.26e-7) || !(th <= 4.6e+25)) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (th <= -2.26e-7) or not (th <= 4.6e+25): tmp = math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky))) else: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th return tmp
function code(kx, ky, th) tmp = 0.0 if ((th <= -2.26e-7) || !(th <= 4.6e+25)) tmp = Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky)))); else tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((th <= -2.26e-7) || ~((th <= 4.6e+25))) tmp = sin(th) / (hypot(sin(kx), sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky))); else tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[th, -2.26e-7], N[Not[LessEqual[th, 4.6e+25]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -2.26 \cdot 10^{-7} \lor \neg \left(th \leq 4.6 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\end{array}
\end{array}
if th < -2.26000000000000012e-7 or 4.5999999999999996e25 < th Initial program 94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.5%
hypot-udef94.8%
unpow294.8%
unpow294.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.5%
Applied egg-rr99.5%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 52.7%
if -2.26000000000000012e-7 < th < 4.5999999999999996e25Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 98.4%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(if (or (<= (sin ky) 1e-146)
(and (not (<= (sin ky) 1e-74)) (<= (sin ky) 5e-32)))
(/ ky (/ (sin kx) th))
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) <= 1e-146) || (!(sin(ky) <= 1e-74) && (sin(ky) <= 5e-32))) {
tmp = ky / (sin(kx) / 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 ((sin(ky) <= 1d-146) .or. (.not. (sin(ky) <= 1d-74)) .and. (sin(ky) <= 5d-32)) then
tmp = ky / (sin(kx) / th)
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) <= 1e-146) || (!(Math.sin(ky) <= 1e-74) && (Math.sin(ky) <= 5e-32))) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) <= 1e-146) or (not (math.sin(ky) <= 1e-74) and (math.sin(ky) <= 5e-32)): tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((sin(ky) <= 1e-146) || (!(sin(ky) <= 1e-74) && (sin(ky) <= 5e-32))) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) <= 1e-146) || (~((sin(ky) <= 1e-74)) && (sin(ky) <= 5e-32))) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-146], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-74]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 5e-32]]], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-146} \lor \neg \left(\sin ky \leq 10^{-74}\right) \land \sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000003e-146 or 9.99999999999999958e-75 < (sin.f64 ky) < 5e-32Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
hypot-udef91.9%
unpow291.9%
unpow291.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 38.1%
Taylor expanded in th around 0 21.3%
associate-/l*22.9%
Simplified22.9%
if 1.00000000000000003e-146 < (sin.f64 ky) < 9.99999999999999958e-75 or 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.7%
Final simplification35.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 1e-146)
(/ (* ky (sin th)) kx)
(if (<= (sin ky) 1e-74)
(sin th)
(if (<= (sin ky) 5e-32) (/ ky (/ (sin kx) th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-146) {
tmp = (ky * sin(th)) / kx;
} else if (sin(ky) <= 1e-74) {
tmp = sin(th);
} else if (sin(ky) <= 5e-32) {
tmp = ky / (sin(kx) / 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 (sin(ky) <= 1d-146) then
tmp = (ky * sin(th)) / kx
else if (sin(ky) <= 1d-74) then
tmp = sin(th)
else if (sin(ky) <= 5d-32) then
tmp = ky / (sin(kx) / th)
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) <= 1e-146) {
tmp = (ky * Math.sin(th)) / kx;
} else if (Math.sin(ky) <= 1e-74) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 5e-32) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-146: tmp = (ky * math.sin(th)) / kx elif math.sin(ky) <= 1e-74: tmp = math.sin(th) elif math.sin(ky) <= 5e-32: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-146) tmp = Float64(Float64(ky * sin(th)) / kx); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-146) tmp = (ky * sin(th)) / kx; elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-146], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-74], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-146}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000003e-146Initial program 91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
hypot-udef91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 36.7%
Taylor expanded in kx around 0 24.3%
if 1.00000000000000003e-146 < (sin.f64 ky) < 9.99999999999999958e-75 or 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.7%
if 9.99999999999999958e-75 < (sin.f64 ky) < 5e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.6%
associate-/r*99.8%
hypot-udef99.8%
unpow299.8%
unpow299.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 72.3%
Taylor expanded in th around 0 44.6%
associate-/l*44.8%
Simplified44.8%
Final simplification37.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 1e-146)
(/ (/ ky kx) (/ 1.0 (sin th)))
(if (<= (sin ky) 1e-74)
(sin th)
(if (<= (sin ky) 5e-32) (/ ky (/ (sin kx) th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-146) {
tmp = (ky / kx) / (1.0 / sin(th));
} else if (sin(ky) <= 1e-74) {
tmp = sin(th);
} else if (sin(ky) <= 5e-32) {
tmp = ky / (sin(kx) / 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 (sin(ky) <= 1d-146) then
tmp = (ky / kx) / (1.0d0 / sin(th))
else if (sin(ky) <= 1d-74) then
tmp = sin(th)
else if (sin(ky) <= 5d-32) then
tmp = ky / (sin(kx) / th)
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) <= 1e-146) {
tmp = (ky / kx) / (1.0 / Math.sin(th));
} else if (Math.sin(ky) <= 1e-74) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 5e-32) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-146: tmp = (ky / kx) / (1.0 / math.sin(th)) elif math.sin(ky) <= 1e-74: tmp = math.sin(th) elif math.sin(ky) <= 5e-32: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-146) tmp = Float64(Float64(ky / kx) / Float64(1.0 / sin(th))); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-146) tmp = (ky / kx) / (1.0 / sin(th)); elseif (sin(ky) <= 1e-74) tmp = sin(th); elseif (sin(ky) <= 5e-32) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-146], N[(N[(ky / kx), $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-74], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-146}:\\
\;\;\;\;\frac{\frac{ky}{kx}}{\frac{1}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000003e-146Initial program 91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
hypot-udef91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 36.7%
Taylor expanded in kx around 0 25.9%
if 1.00000000000000003e-146 < (sin.f64 ky) < 9.99999999999999958e-75 or 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.7%
if 9.99999999999999958e-75 < (sin.f64 ky) < 5e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.6%
associate-/r*99.8%
hypot-udef99.8%
unpow299.8%
unpow299.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 72.3%
Taylor expanded in th around 0 44.6%
associate-/l*44.8%
Simplified44.8%
Final simplification38.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-17) (fabs (sin th)) (if (<= (sin ky) 5e-32) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-32) {
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) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-32) 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) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-32) {
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) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-32: 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], 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 -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < 5e-32Initial program 87.9%
+-commutative87.9%
unpow287.9%
unpow287.9%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef87.8%
unpow287.8%
unpow287.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.7%
Applied egg-rr99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 55.4%
associate-*r/57.8%
Simplified57.8%
if 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 64.7%
Final simplification51.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-17) (fabs (sin th)) (if (<= (sin ky) 5e-32) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-32) {
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) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-32) 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) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-32) {
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) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-32: 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], 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 -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < 5e-32Initial program 87.9%
Taylor expanded in ky around 0 57.8%
if 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 64.7%
Final simplification51.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-17) (fabs (sin th)) (if (<= (sin ky) 5e-32) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-32) {
tmp = ky / (sin(kx) / 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 (sin(ky) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-32) then
tmp = ky / (sin(kx) / 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 (Math.sin(ky) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-32) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-32: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < 5e-32Initial program 87.9%
+-commutative87.9%
unpow287.9%
unpow287.9%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef87.8%
unpow287.8%
unpow287.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 55.4%
associate-/l*57.8%
Simplified57.8%
if 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 64.7%
Final simplification51.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -9.5)
(sin th)
(if (or (<= ky 6.6e-146) (and (not (<= ky 3.6e-70)) (<= ky 3.2e-32)))
(* ky (/ th (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = sin(th);
} else if ((ky <= 6.6e-146) || (!(ky <= 3.6e-70) && (ky <= 3.2e-32))) {
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 <= (-9.5d0)) then
tmp = sin(th)
else if ((ky <= 6.6d-146) .or. (.not. (ky <= 3.6d-70)) .and. (ky <= 3.2d-32)) 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 <= -9.5) {
tmp = Math.sin(th);
} else if ((ky <= 6.6e-146) || (!(ky <= 3.6e-70) && (ky <= 3.2e-32))) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -9.5: tmp = math.sin(th) elif (ky <= 6.6e-146) or (not (ky <= 3.6e-70) and (ky <= 3.2e-32)): tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -9.5) tmp = sin(th); elseif ((ky <= 6.6e-146) || (!(ky <= 3.6e-70) && (ky <= 3.2e-32))) 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 <= -9.5) tmp = sin(th); elseif ((ky <= 6.6e-146) || (~((ky <= 3.6e-70)) && (ky <= 3.2e-32))) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -9.5], N[Sin[th], $MachinePrecision], If[Or[LessEqual[ky, 6.6e-146], And[N[Not[LessEqual[ky, 3.6e-70]], $MachinePrecision], LessEqual[ky, 3.2e-32]]], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 6.6 \cdot 10^{-146} \lor \neg \left(ky \leq 3.6 \cdot 10^{-70}\right) \land ky \leq 3.2 \cdot 10^{-32}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -9.5 or 6.6e-146 < ky < 3.6000000000000002e-70 or 3.2000000000000002e-32 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 35.0%
if -9.5 < ky < 6.6e-146 or 3.6000000000000002e-70 < ky < 3.2000000000000002e-32Initial program 87.0%
+-commutative87.0%
unpow287.0%
unpow287.0%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.6%
hypot-udef86.9%
unpow286.9%
unpow286.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 61.0%
Taylor expanded in th around 0 33.5%
associate-/l*36.1%
Simplified36.1%
clear-num34.6%
associate-/r/36.0%
clear-num36.0%
Applied egg-rr36.0%
Final simplification35.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -9.5) (sin th) (if (<= ky 3.05e-145) (/ ky (/ kx th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = sin(th);
} else if (ky <= 3.05e-145) {
tmp = ky / (kx / 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 <= (-9.5d0)) then
tmp = sin(th)
else if (ky <= 3.05d-145) then
tmp = ky / (kx / 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 <= -9.5) {
tmp = Math.sin(th);
} else if (ky <= 3.05e-145) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -9.5: tmp = math.sin(th) elif ky <= 3.05e-145: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -9.5) tmp = sin(th); elseif (ky <= 3.05e-145) tmp = Float64(ky / Float64(kx / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -9.5) tmp = sin(th); elseif (ky <= 3.05e-145) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -9.5], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.05e-145], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.05 \cdot 10^{-145}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -9.5 or 3.05e-145 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.8%
if -9.5 < ky < 3.05e-145Initial program 86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.6%
hypot-udef86.0%
unpow286.0%
unpow286.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 60.2%
Taylor expanded in th around 0 32.7%
associate-/l*35.4%
Simplified35.4%
Taylor expanded in kx around 0 29.4%
associate-/l*32.1%
Simplified32.1%
Final simplification33.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -0.8) th (if (<= ky 1.02e-32) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.8) {
tmp = th;
} else if (ky <= 1.02e-32) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-0.8d0)) then
tmp = th
else if (ky <= 1.02d-32) then
tmp = ky / (kx / th)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.8) {
tmp = th;
} else if (ky <= 1.02e-32) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.8: tmp = th elif ky <= 1.02e-32: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.8) tmp = th; elseif (ky <= 1.02e-32) tmp = Float64(ky / Float64(kx / th)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -0.8) tmp = th; elseif (ky <= 1.02e-32) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.8], th, If[LessEqual[ky, 1.02e-32], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.8:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.02 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -0.80000000000000004 or 1.02000000000000002e-32 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.0%
Taylor expanded in th around 0 20.8%
if -0.80000000000000004 < ky < 1.02000000000000002e-32Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.6%
hypot-udef88.0%
unpow288.0%
unpow288.0%
+-commutative88.0%
unpow288.0%
unpow288.0%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 56.9%
Taylor expanded in th around 0 31.8%
associate-/l*34.1%
Simplified34.1%
Taylor expanded in kx around 0 28.2%
associate-/l*30.4%
Simplified30.4%
Final simplification25.2%
(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 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 23.3%
Taylor expanded in th around 0 14.2%
Final simplification14.2%
herbie shell --seed 2023299
(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)))