
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(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 92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ ky (fabs (sin kx)))))
(t_2 (/ (sin ky) (/ (hypot kx (sin ky)) th))))
(if (<= (sin ky) -2e-22)
t_2
(if (<= (sin ky) -5e-173)
t_1
(if (<= (sin ky) -5e-190) t_2 (if (<= (sin ky) 5e-35) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (ky / fabs(sin(kx)));
double t_2 = sin(ky) / (hypot(kx, sin(ky)) / th);
double tmp;
if (sin(ky) <= -2e-22) {
tmp = t_2;
} else if (sin(ky) <= -5e-173) {
tmp = t_1;
} else if (sin(ky) <= -5e-190) {
tmp = t_2;
} else if (sin(ky) <= 5e-35) {
tmp = t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
double t_2 = Math.sin(ky) / (Math.hypot(kx, Math.sin(ky)) / th);
double tmp;
if (Math.sin(ky) <= -2e-22) {
tmp = t_2;
} else if (Math.sin(ky) <= -5e-173) {
tmp = t_1;
} else if (Math.sin(ky) <= -5e-190) {
tmp = t_2;
} else if (Math.sin(ky) <= 5e-35) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (ky / math.fabs(math.sin(kx))) t_2 = math.sin(ky) / (math.hypot(kx, math.sin(ky)) / th) tmp = 0 if math.sin(ky) <= -2e-22: tmp = t_2 elif math.sin(ky) <= -5e-173: tmp = t_1 elif math.sin(ky) <= -5e-190: tmp = t_2 elif math.sin(ky) <= 5e-35: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(ky / abs(sin(kx)))) t_2 = Float64(sin(ky) / Float64(hypot(kx, sin(ky)) / th)) tmp = 0.0 if (sin(ky) <= -2e-22) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = t_1; elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (ky / abs(sin(kx))); t_2 = sin(ky) / (hypot(kx, sin(ky)) / th); tmp = 0.0; if (sin(ky) <= -2e-22) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = t_1; elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-22], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-173], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-190], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
t_2 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{th}}\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-190}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.0000000000000001e-22 or -5.0000000000000002e-173 < (sin.f64 ky) < -5.00000000000000034e-190Initial program 93.3%
associate-*l/92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-udef94.8%
associate-*l/99.6%
expm1-log1p-u99.6%
expm1-udef44.5%
Applied egg-rr44.4%
expm1-def99.4%
expm1-log1p99.5%
Simplified99.5%
Taylor expanded in th around 0 55.9%
associate-*l/56.0%
unpow256.0%
unpow256.0%
hypot-def62.4%
*-lft-identity62.4%
Simplified62.4%
Taylor expanded in kx around 0 31.3%
if -2.0000000000000001e-22 < (sin.f64 ky) < -5.0000000000000002e-173 or -5.00000000000000034e-190 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 86.2%
+-commutative86.2%
unpow286.2%
unpow286.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 56.3%
add-sqr-sqrt47.8%
sqrt-prod78.5%
rem-sqrt-square86.6%
Applied egg-rr86.6%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification63.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin kx))) (t_2 (/ (sin ky) (/ (hypot kx (sin ky)) th))))
(if (<= (sin ky) -0.2)
t_2
(if (<= (sin ky) -5e-173)
(* (sin th) (/ (sin ky) t_1))
(if (<= (sin ky) -5e-190)
t_2
(if (<= (sin ky) 5e-35) (* (sin th) (/ ky t_1)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(kx));
double t_2 = sin(ky) / (hypot(kx, sin(ky)) / th);
double tmp;
if (sin(ky) <= -0.2) {
tmp = t_2;
} else if (sin(ky) <= -5e-173) {
tmp = sin(th) * (sin(ky) / t_1);
} else if (sin(ky) <= -5e-190) {
tmp = t_2;
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(kx));
double t_2 = Math.sin(ky) / (Math.hypot(kx, Math.sin(ky)) / th);
double tmp;
if (Math.sin(ky) <= -0.2) {
tmp = t_2;
} else if (Math.sin(ky) <= -5e-173) {
tmp = Math.sin(th) * (Math.sin(ky) / t_1);
} else if (Math.sin(ky) <= -5e-190) {
tmp = t_2;
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(kx)) t_2 = math.sin(ky) / (math.hypot(kx, math.sin(ky)) / th) tmp = 0 if math.sin(ky) <= -0.2: tmp = t_2 elif math.sin(ky) <= -5e-173: tmp = math.sin(th) * (math.sin(ky) / t_1) elif math.sin(ky) <= -5e-190: tmp = t_2 elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(kx)) t_2 = Float64(sin(ky) / Float64(hypot(kx, sin(ky)) / th)) tmp = 0.0 if (sin(ky) <= -0.2) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = Float64(sin(th) * Float64(sin(ky) / t_1)); elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(kx)); t_2 = sin(ky) / (hypot(kx, sin(ky)) / th); tmp = 0.0; if (sin(ky) <= -0.2) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = sin(th) * (sin(ky) / t_1); elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.2], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-173], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-190], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin kx\right|\\
t_2 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{th}}\\
\mathbf{if}\;\sin ky \leq -0.2:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-173}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_1}\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-190}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.20000000000000001 or -5.0000000000000002e-173 < (sin.f64 ky) < -5.00000000000000034e-190Initial program 92.2%
associate-*l/90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-udef94.0%
associate-*l/99.7%
expm1-log1p-u99.7%
expm1-udef45.8%
Applied egg-rr45.8%
expm1-def99.5%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in th around 0 53.9%
associate-*l/54.0%
unpow254.0%
unpow254.0%
hypot-def61.6%
*-lft-identity61.6%
Simplified61.6%
Taylor expanded in kx around 0 34.5%
if -0.20000000000000001 < (sin.f64 ky) < -5.0000000000000002e-173Initial program 99.5%
Taylor expanded in ky around 0 46.8%
add-sqr-sqrt32.4%
sqrt-prod54.9%
rem-sqrt-square55.0%
Applied egg-rr59.9%
if -5.00000000000000034e-190 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 82.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 53.5%
add-sqr-sqrt47.6%
sqrt-prod78.2%
rem-sqrt-square88.6%
Applied egg-rr88.6%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification63.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin kx))) (t_2 (/ (sin ky) (/ (hypot kx (sin ky)) th))))
(if (<= (sin ky) -0.2)
t_2
(if (<= (sin ky) -5e-173)
(* (sin ky) (/ (sin th) t_1))
(if (<= (sin ky) -5e-190)
t_2
(if (<= (sin ky) 5e-35) (* (sin th) (/ ky t_1)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(kx));
double t_2 = sin(ky) / (hypot(kx, sin(ky)) / th);
double tmp;
if (sin(ky) <= -0.2) {
tmp = t_2;
} else if (sin(ky) <= -5e-173) {
tmp = sin(ky) * (sin(th) / t_1);
} else if (sin(ky) <= -5e-190) {
tmp = t_2;
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(kx));
double t_2 = Math.sin(ky) / (Math.hypot(kx, Math.sin(ky)) / th);
double tmp;
if (Math.sin(ky) <= -0.2) {
tmp = t_2;
} else if (Math.sin(ky) <= -5e-173) {
tmp = Math.sin(ky) * (Math.sin(th) / t_1);
} else if (Math.sin(ky) <= -5e-190) {
tmp = t_2;
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(kx)) t_2 = math.sin(ky) / (math.hypot(kx, math.sin(ky)) / th) tmp = 0 if math.sin(ky) <= -0.2: tmp = t_2 elif math.sin(ky) <= -5e-173: tmp = math.sin(ky) * (math.sin(th) / t_1) elif math.sin(ky) <= -5e-190: tmp = t_2 elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(kx)) t_2 = Float64(sin(ky) / Float64(hypot(kx, sin(ky)) / th)) tmp = 0.0 if (sin(ky) <= -0.2) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = Float64(sin(ky) * Float64(sin(th) / t_1)); elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(kx)); t_2 = sin(ky) / (hypot(kx, sin(ky)) / th); tmp = 0.0; if (sin(ky) <= -0.2) tmp = t_2; elseif (sin(ky) <= -5e-173) tmp = sin(ky) * (sin(th) / t_1); elseif (sin(ky) <= -5e-190) tmp = t_2; elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.2], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-173], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-190], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin kx\right|\\
t_2 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{th}}\\
\mathbf{if}\;\sin ky \leq -0.2:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-173}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t_1}\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-190}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.20000000000000001 or -5.0000000000000002e-173 < (sin.f64 ky) < -5.00000000000000034e-190Initial program 92.2%
associate-*l/90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-udef94.0%
associate-*l/99.7%
expm1-log1p-u99.7%
expm1-udef45.8%
Applied egg-rr45.8%
expm1-def99.5%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in th around 0 53.9%
associate-*l/54.0%
unpow254.0%
unpow254.0%
hypot-def61.6%
*-lft-identity61.6%
Simplified61.6%
Taylor expanded in kx around 0 34.5%
if -0.20000000000000001 < (sin.f64 ky) < -5.0000000000000002e-173Initial program 99.5%
associate-*l/97.4%
*-commutative97.4%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 46.8%
add-sqr-sqrt32.4%
sqrt-prod54.9%
rem-sqrt-square55.0%
Applied egg-rr59.9%
if -5.00000000000000034e-190 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 82.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 53.5%
add-sqr-sqrt47.6%
sqrt-prod78.2%
rem-sqrt-square88.6%
Applied egg-rr88.6%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification63.7%
(FPCore (kx ky th) :precision binary64 (if (or (<= (sin th) -0.01) (not (<= (sin th) 0.002))) (* (sin th) (/ (sin ky) (fabs (sin kx)))) (* (sin ky) (/ th (hypot (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) <= -0.01) || !(sin(th) <= 0.002)) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) <= -0.01) || !(Math.sin(th) <= 0.002)) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) <= -0.01) or not (math.sin(th) <= 0.002): tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((sin(th) <= -0.01) || !(sin(th) <= 0.002)) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) <= -0.01) || ~((sin(th) <= 0.002))) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[N[Sin[th], $MachinePrecision], -0.01], N[Not[LessEqual[N[Sin[th], $MachinePrecision], 0.002]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.01 \lor \neg \left(\sin th \leq 0.002\right):\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0100000000000000002 or 2e-3 < (sin.f64 th) Initial program 94.7%
Taylor expanded in ky around 0 21.8%
add-sqr-sqrt18.3%
sqrt-prod36.0%
rem-sqrt-square39.2%
Applied egg-rr45.0%
if -0.0100000000000000002 < (sin.f64 th) < 2e-3Initial program 90.2%
associate-*l/86.6%
+-commutative86.6%
unpow286.6%
unpow286.6%
hypot-udef89.9%
associate-*l/99.7%
expm1-log1p-u99.7%
expm1-udef23.1%
Applied egg-rr23.1%
expm1-def99.6%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in th around 0 89.3%
associate-*l/89.5%
unpow289.5%
unpow289.5%
hypot-def99.0%
*-lft-identity99.0%
Simplified99.0%
clear-num98.5%
associate-/r/98.9%
clear-num99.1%
hypot-udef89.6%
+-commutative89.6%
hypot-udef99.1%
Applied egg-rr99.1%
Final simplification73.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin kx))))
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 5e-35) (* (sin th) (/ ky t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(kx));
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / 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 = abs(sin(kx))
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * (th / t_1)
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * (ky / 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 = Math.abs(Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(kx)) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(kx)); tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin kx\right|\\
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.5%
*-commutative99.5%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 7.9%
add-sqr-sqrt1.5%
sqrt-prod2.9%
rem-sqrt-square3.0%
Applied egg-rr15.1%
Taylor expanded in th around 0 10.3%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 83.5%
+-commutative83.5%
unpow283.5%
unpow283.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 53.8%
add-sqr-sqrt44.3%
sqrt-prod73.8%
rem-sqrt-square81.2%
Applied egg-rr81.2%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification58.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin ky) (/ th (hypot (sin ky) (sin kx)))))
(t_2 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 1.5e+103)
t_1
(if (<= kx 1.3e+141)
(/ (* (sin ky) (sin th)) t_2)
(if (<= kx 2.7e+235) t_1 (* (sin th) (/ (sin ky) t_2))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) * (th / hypot(sin(ky), sin(kx)));
double t_2 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 1.5e+103) {
tmp = t_1;
} else if (kx <= 1.3e+141) {
tmp = (sin(ky) * sin(th)) / t_2;
} else if (kx <= 2.7e+235) {
tmp = t_1;
} else {
tmp = sin(th) * (sin(ky) / t_2);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
double t_2 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 1.5e+103) {
tmp = t_1;
} else if (kx <= 1.3e+141) {
tmp = (Math.sin(ky) * Math.sin(th)) / t_2;
} else if (kx <= 2.7e+235) {
tmp = t_1;
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_2);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) t_2 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 1.5e+103: tmp = t_1 elif kx <= 1.3e+141: tmp = (math.sin(ky) * math.sin(th)) / t_2 elif kx <= 2.7e+235: tmp = t_1 else: tmp = math.sin(th) * (math.sin(ky) / t_2) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))) t_2 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 1.5e+103) tmp = t_1; elseif (kx <= 1.3e+141) tmp = Float64(Float64(sin(ky) * sin(th)) / t_2); elseif (kx <= 2.7e+235) tmp = t_1; else tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) * (th / hypot(sin(ky), sin(kx))); t_2 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 1.5e+103) tmp = t_1; elseif (kx <= 1.3e+141) tmp = (sin(ky) * sin(th)) / t_2; elseif (kx <= 2.7e+235) tmp = t_1; else tmp = sin(th) * (sin(ky) / t_2); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 1.5e+103], t$95$1, If[LessEqual[kx, 1.3e+141], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[kx, 2.7e+235], t$95$1, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_2 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 1.5 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;kx \leq 1.3 \cdot 10^{+141}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{t_2}\\
\mathbf{elif}\;kx \leq 2.7 \cdot 10^{+235}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_2}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 1.5e103 or 1.3e141 < kx < 2.6999999999999997e235Initial program 99.5%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-udef99.5%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef34.8%
Applied egg-rr34.8%
expm1-def99.5%
expm1-log1p99.5%
Simplified99.5%
Taylor expanded in th around 0 68.6%
associate-*l/68.7%
unpow268.7%
unpow268.7%
hypot-def68.8%
*-lft-identity68.8%
Simplified68.8%
clear-num68.7%
associate-/r/68.7%
clear-num68.9%
hypot-udef68.8%
+-commutative68.8%
hypot-udef68.9%
Applied egg-rr68.9%
if 1.5e103 < kx < 1.3e141Initial program 99.6%
associate-*l/99.9%
*-commutative99.9%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 38.6%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.1%
Taylor expanded in th around inf 65.5%
if 2.6999999999999997e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 8.8e+102)
(* (/ (sin ky) t_1) th)
(if (<= kx 3.4e+141)
(/ (* (sin ky) (sin th)) t_2)
(if (<= kx 2.4e+235)
(* (sin ky) (/ th t_1))
(* (sin th) (/ (sin ky) t_2))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 8.8e+102) {
tmp = (sin(ky) / t_1) * th;
} else if (kx <= 3.4e+141) {
tmp = (sin(ky) * sin(th)) / t_2;
} else if (kx <= 2.4e+235) {
tmp = sin(ky) * (th / t_1);
} else {
tmp = sin(th) * (sin(ky) / t_2);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 8.8e+102) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (kx <= 3.4e+141) {
tmp = (Math.sin(ky) * Math.sin(th)) / t_2;
} else if (kx <= 2.4e+235) {
tmp = Math.sin(ky) * (th / t_1);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_2);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 8.8e+102: tmp = (math.sin(ky) / t_1) * th elif kx <= 3.4e+141: tmp = (math.sin(ky) * math.sin(th)) / t_2 elif kx <= 2.4e+235: tmp = math.sin(ky) * (th / t_1) else: tmp = math.sin(th) * (math.sin(ky) / t_2) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 8.8e+102) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (kx <= 3.4e+141) tmp = Float64(Float64(sin(ky) * sin(th)) / t_2); elseif (kx <= 2.4e+235) tmp = Float64(sin(ky) * Float64(th / t_1)); else tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 8.8e+102) tmp = (sin(ky) / t_1) * th; elseif (kx <= 3.4e+141) tmp = (sin(ky) * sin(th)) / t_2; elseif (kx <= 2.4e+235) tmp = sin(ky) * (th / t_1); else tmp = sin(th) * (sin(ky) / t_2); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 8.8e+102], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[kx, 3.4e+141], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[kx, 2.4e+235], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 8.8 \cdot 10^{+102}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;kx \leq 3.4 \cdot 10^{+141}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{t_2}\\
\mathbf{elif}\;kx \leq 2.4 \cdot 10^{+235}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_2}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 8.8000000000000003e102Initial program 99.5%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.7%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef47.4%
Applied egg-rr47.4%
expm1-def99.8%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in th around 0 65.3%
associate-*l/65.4%
unpow265.4%
unpow265.4%
hypot-def65.4%
*-lft-identity65.4%
Simplified65.4%
associate-/r/65.3%
hypot-udef65.3%
+-commutative65.3%
hypot-udef65.3%
Applied egg-rr65.3%
if 8.8000000000000003e102 < kx < 3.3999999999999998e141Initial program 99.6%
associate-*l/99.9%
*-commutative99.9%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 38.6%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.1%
Taylor expanded in th around inf 65.5%
if 3.3999999999999998e141 < kx < 2.3999999999999999e235Initial program 99.5%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-udef99.4%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef24.3%
Applied egg-rr24.3%
expm1-def99.3%
expm1-log1p99.3%
Simplified99.3%
Taylor expanded in th around 0 71.4%
associate-*l/71.5%
unpow271.5%
unpow271.5%
hypot-def71.5%
*-lft-identity71.5%
Simplified71.5%
clear-num71.5%
associate-/r/71.5%
clear-num71.9%
hypot-udef71.7%
+-commutative71.7%
hypot-udef71.9%
Applied egg-rr71.9%
if 2.3999999999999999e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 3.3e+102)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= kx 5.4e+141)
(/ (* (sin ky) (sin th)) t_1)
(if (<= kx 9.5e+235)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin th) (/ (sin ky) t_1))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 3.3e+102) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (kx <= 5.4e+141) {
tmp = (sin(ky) * sin(th)) / t_1;
} else if (kx <= 9.5e+235) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 3.3e+102) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (kx <= 5.4e+141) {
tmp = (Math.sin(ky) * Math.sin(th)) / t_1;
} else if (kx <= 9.5e+235) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 3.3e+102: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif kx <= 5.4e+141: tmp = (math.sin(ky) * math.sin(th)) / t_1 elif kx <= 9.5e+235: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / t_1) return tmp
function code(kx, ky, th) t_1 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 3.3e+102) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (kx <= 5.4e+141) tmp = Float64(Float64(sin(ky) * sin(th)) / t_1); elseif (kx <= 9.5e+235) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 3.3e+102) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (kx <= 5.4e+141) tmp = (sin(ky) * sin(th)) / t_1; elseif (kx <= 9.5e+235) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) * (sin(ky) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 3.3e+102], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 5.4e+141], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[kx, 9.5e+235], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 3.3 \cdot 10^{+102}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;kx \leq 5.4 \cdot 10^{+141}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{t_1}\\
\mathbf{elif}\;kx \leq 9.5 \cdot 10^{+235}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_1}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 3.29999999999999999e102Initial program 99.5%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.7%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef47.4%
Applied egg-rr47.4%
expm1-def99.8%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in th around 0 65.3%
associate-*l/65.4%
unpow265.4%
unpow265.4%
hypot-def65.4%
*-lft-identity65.4%
Simplified65.4%
if 3.29999999999999999e102 < kx < 5.4000000000000002e141Initial program 99.6%
associate-*l/99.9%
*-commutative99.9%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 38.6%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.1%
Taylor expanded in th around inf 65.5%
if 5.4000000000000002e141 < kx < 9.49999999999999966e235Initial program 99.5%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-udef99.4%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef24.3%
Applied egg-rr24.3%
expm1-def99.3%
expm1-log1p99.3%
Simplified99.3%
Taylor expanded in th around 0 71.4%
associate-*l/71.5%
unpow271.5%
unpow271.5%
hypot-def71.5%
*-lft-identity71.5%
Simplified71.5%
clear-num71.5%
associate-/r/71.5%
clear-num71.9%
hypot-udef71.7%
+-commutative71.7%
hypot-udef71.9%
Applied egg-rr71.9%
if 9.49999999999999966e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 6.6e+101)
(* (sin ky) (/ 1.0 (/ (hypot (sin kx) (sin ky)) th)))
(if (<= kx 2.5e+144)
(/ (* (sin ky) (sin th)) t_1)
(if (<= kx 4.4e+235)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin th) (/ (sin ky) t_1))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 6.6e+101) {
tmp = sin(ky) * (1.0 / (hypot(sin(kx), sin(ky)) / th));
} else if (kx <= 2.5e+144) {
tmp = (sin(ky) * sin(th)) / t_1;
} else if (kx <= 4.4e+235) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 6.6e+101) {
tmp = Math.sin(ky) * (1.0 / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th));
} else if (kx <= 2.5e+144) {
tmp = (Math.sin(ky) * Math.sin(th)) / t_1;
} else if (kx <= 4.4e+235) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 6.6e+101: tmp = math.sin(ky) * (1.0 / (math.hypot(math.sin(kx), math.sin(ky)) / th)) elif kx <= 2.5e+144: tmp = (math.sin(ky) * math.sin(th)) / t_1 elif kx <= 4.4e+235: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / t_1) return tmp
function code(kx, ky, th) t_1 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 6.6e+101) tmp = Float64(sin(ky) * Float64(1.0 / Float64(hypot(sin(kx), sin(ky)) / th))); elseif (kx <= 2.5e+144) tmp = Float64(Float64(sin(ky) * sin(th)) / t_1); elseif (kx <= 4.4e+235) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 6.6e+101) tmp = sin(ky) * (1.0 / (hypot(sin(kx), sin(ky)) / th)); elseif (kx <= 2.5e+144) tmp = (sin(ky) * sin(th)) / t_1; elseif (kx <= 4.4e+235) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) * (sin(ky) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 6.6e+101], N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 2.5e+144], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[kx, 4.4e+235], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 6.6 \cdot 10^{+101}:\\
\;\;\;\;\sin ky \cdot \frac{1}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;kx \leq 2.5 \cdot 10^{+144}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{t_1}\\
\mathbf{elif}\;kx \leq 4.4 \cdot 10^{+235}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_1}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 6.60000000000000022e101Initial program 99.5%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
clear-num99.6%
inv-pow99.6%
hypot-udef99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Applied egg-rr99.6%
unpow-199.6%
hypot-def99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 65.3%
associate-*l/65.3%
+-commutative65.3%
unpow265.3%
unpow265.3%
hypot-def65.3%
*-lft-identity65.3%
hypot-def65.3%
unpow265.3%
unpow265.3%
+-commutative65.3%
unpow265.3%
unpow265.3%
hypot-def65.3%
Simplified65.3%
if 6.60000000000000022e101 < kx < 2.5e144Initial program 99.6%
associate-*l/99.9%
*-commutative99.9%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 38.6%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.1%
Taylor expanded in th around inf 65.5%
if 2.5e144 < kx < 4.4e235Initial program 99.5%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-udef99.4%
associate-*l/99.5%
expm1-log1p-u99.5%
expm1-udef24.3%
Applied egg-rr24.3%
expm1-def99.3%
expm1-log1p99.3%
Simplified99.3%
Taylor expanded in th around 0 71.4%
associate-*l/71.5%
unpow271.5%
unpow271.5%
hypot-def71.5%
*-lft-identity71.5%
Simplified71.5%
clear-num71.5%
associate-/r/71.5%
clear-num71.9%
hypot-udef71.7%
+-commutative71.7%
hypot-udef71.9%
Applied egg-rr71.9%
if 4.4e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-35) (* (sin th) (/ ky (fabs (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / fabs(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) <= 5d-35) then
tmp = sin(th) * (ky / abs(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) <= 5e-35) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-35) tmp = sin(th) * (ky / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.99999999999999964e-35Initial program 89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 35.9%
add-sqr-sqrt29.1%
sqrt-prod48.7%
rem-sqrt-square53.6%
Applied egg-rr53.6%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification56.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-35) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-35) {
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) <= 1d-35) 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) <= 1e-35) {
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) <= 1e-35: 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) <= 1e-35) 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) <= 1e-35) 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], 1e-35], 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 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000001e-35Initial program 89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 36.1%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-35) (/ ky (/ (sin kx) (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-35) {
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) <= 1d-35) 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) <= 1e-35) {
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) <= 1e-35: 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) <= 1e-35) 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) <= 1e-35) 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], 1e-35], 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 10^{-35}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000001e-35Initial program 89.1%
Taylor expanded in ky around 0 33.1%
associate-/l*36.1%
Simplified36.1%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-35) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-35) {
tmp = sin(th) / (sin(kx) / ky);
} 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-35) then
tmp = sin(th) / (sin(kx) / ky)
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-35) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-35: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-35) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-35) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-35], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-35}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000001e-35Initial program 89.1%
*-commutative89.1%
clear-num89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 36.2%
if 1.00000000000000001e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.0%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-52) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-52) {
tmp = ky / (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) <= 4d-52) then
tmp = ky / (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) <= 4e-52) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 4e-52: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4e-52) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 4e-52) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-52], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-52}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4e-52Initial program 89.0%
+-commutative89.0%
unpow289.0%
unpow289.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 35.6%
Taylor expanded in kx around 0 25.1%
associate-/l*28.3%
Simplified28.3%
if 4e-52 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 60.9%
Final simplification38.4%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -5200.0) (not (<= ky 2.35e-51))) (sin th) (* (sin th) (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 2.35e-51)) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-5200.0d0)) .or. (.not. (ky <= 2.35d-51))) then
tmp = sin(th)
else
tmp = sin(th) * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 2.35e-51)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -5200.0) or not (ky <= 2.35e-51): tmp = math.sin(th) else: tmp = math.sin(th) * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -5200.0) || !(ky <= 2.35e-51)) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -5200.0) || ~((ky <= 2.35e-51))) tmp = sin(th); else tmp = sin(th) * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -5200.0], N[Not[LessEqual[ky, 2.35e-51]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5200 \lor \neg \left(ky \leq 2.35 \cdot 10^{-51}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -5200 or 2.3499999999999999e-51 < ky Initial program 99.7%
Taylor expanded in kx around 0 34.6%
if -5200 < ky < 2.3499999999999999e-51Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.8%
Taylor expanded in kx around 0 42.6%
Final simplification38.1%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -5200.0) (not (<= ky 2.4e-52))) (sin th) (* ky (/ (sin th) kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 2.4e-52)) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-5200.0d0)) .or. (.not. (ky <= 2.4d-52))) then
tmp = sin(th)
else
tmp = ky * (sin(th) / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 2.4e-52)) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -5200.0) or not (ky <= 2.4e-52): tmp = math.sin(th) else: tmp = ky * (math.sin(th) / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -5200.0) || !(ky <= 2.4e-52)) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -5200.0) || ~((ky <= 2.4e-52))) tmp = sin(th); else tmp = ky * (sin(th) / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -5200.0], N[Not[LessEqual[ky, 2.4e-52]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5200 \lor \neg \left(ky \leq 2.4 \cdot 10^{-52}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\end{array}
\end{array}
if ky < -5200 or 2.4000000000000002e-52 < ky Initial program 99.7%
Taylor expanded in kx around 0 34.6%
if -5200 < ky < 2.4000000000000002e-52Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.8%
Taylor expanded in kx around 0 42.6%
associate-*l/37.6%
clear-num37.6%
Applied egg-rr37.6%
associate-/r/37.6%
*-commutative37.6%
associate-*r*42.6%
*-commutative42.6%
associate-*r/42.6%
*-rgt-identity42.6%
Simplified42.6%
Final simplification38.1%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -5200.0) (not (<= ky 1.16e-55))) (sin th) (/ ky (/ kx th))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 1.16e-55)) {
tmp = sin(th);
} else {
tmp = ky / (kx / 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 <= (-5200.0d0)) .or. (.not. (ky <= 1.16d-55))) then
tmp = sin(th)
else
tmp = ky / (kx / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5200.0) || !(ky <= 1.16e-55)) {
tmp = Math.sin(th);
} else {
tmp = ky / (kx / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -5200.0) or not (ky <= 1.16e-55): tmp = math.sin(th) else: tmp = ky / (kx / th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -5200.0) || !(ky <= 1.16e-55)) tmp = sin(th); else tmp = Float64(ky / Float64(kx / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -5200.0) || ~((ky <= 1.16e-55))) tmp = sin(th); else tmp = ky / (kx / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -5200.0], N[Not[LessEqual[ky, 1.16e-55]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5200 \lor \neg \left(ky \leq 1.16 \cdot 10^{-55}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\end{array}
\end{array}
if ky < -5200 or 1.15999999999999996e-55 < ky Initial program 99.7%
Taylor expanded in kx around 0 34.4%
if -5200 < ky < 1.15999999999999996e-55Initial program 82.5%
+-commutative82.5%
unpow282.5%
unpow282.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.4%
Taylor expanded in kx around 0 42.1%
Taylor expanded in th around 0 30.0%
associate-/l*35.0%
Simplified35.0%
Final simplification34.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.1e-31) th (if (<= ky 2.3e-51) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.1e-31) {
tmp = th;
} else if (ky <= 2.3e-51) {
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 <= (-1.1d-31)) then
tmp = th
else if (ky <= 2.3d-51) 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 <= -1.1e-31) {
tmp = th;
} else if (ky <= 2.3e-51) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.1e-31: tmp = th elif ky <= 2.3e-51: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.1e-31) tmp = th; elseif (ky <= 2.3e-51) 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 <= -1.1e-31) tmp = th; elseif (ky <= 2.3e-51) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.1e-31], th, If[LessEqual[ky, 2.3e-51], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.1 \cdot 10^{-31}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 2.3 \cdot 10^{-51}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.10000000000000005e-31 or 2.30000000000000002e-51 < ky Initial program 99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-udef99.6%
associate-*l/99.6%
expm1-log1p-u99.6%
expm1-udef50.6%
Applied egg-rr50.6%
expm1-def99.5%
expm1-log1p99.5%
Simplified99.5%
Taylor expanded in th around 0 52.3%
associate-*l/52.4%
unpow252.4%
unpow252.4%
hypot-def52.4%
*-lft-identity52.4%
Simplified52.4%
Taylor expanded in kx around 0 18.3%
if -1.10000000000000005e-31 < ky < 2.30000000000000002e-51Initial program 82.0%
+-commutative82.0%
unpow282.0%
unpow282.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 56.7%
Taylor expanded in kx around 0 44.0%
Taylor expanded in th around 0 30.8%
associate-/l*35.9%
Simplified35.9%
Final simplification25.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 92.3%
associate-*l/90.3%
+-commutative90.3%
unpow290.3%
unpow290.3%
hypot-udef94.4%
associate-*l/99.7%
expm1-log1p-u99.6%
expm1-udef42.4%
Applied egg-rr42.4%
expm1-def99.5%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in th around 0 49.0%
associate-*l/49.1%
unpow249.1%
unpow249.1%
hypot-def54.2%
*-lft-identity54.2%
Simplified54.2%
Taylor expanded in kx around 0 13.4%
Final simplification13.4%
herbie shell --seed 2023314
(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)))