
(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.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)))
(t_2 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.77)
t_1
(if (<= (sin kx) -0.02)
(* ky (/ (sin th) (fabs (sin kx))))
(if (<= (sin kx) 4e-7)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= (sin kx) 0.78)
(* (sin ky) t_2)
(if (<= (sin kx) 0.9) t_1 (/ t_2 (/ 1.0 (sin ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
double t_2 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.77) {
tmp = t_1;
} else if (sin(kx) <= -0.02) {
tmp = ky * (sin(th) / fabs(sin(kx)));
} else if (sin(kx) <= 4e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (sin(kx) <= 0.78) {
tmp = sin(ky) * t_2;
} else if (sin(kx) <= 0.9) {
tmp = t_1;
} else {
tmp = t_2 / (1.0 / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
double t_2 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.77) {
tmp = t_1;
} else if (Math.sin(kx) <= -0.02) {
tmp = ky * (Math.sin(th) / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 4e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(kx) <= 0.78) {
tmp = Math.sin(ky) * t_2;
} else if (Math.sin(kx) <= 0.9) {
tmp = t_1;
} else {
tmp = t_2 / (1.0 / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) t_2 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.77: tmp = t_1 elif math.sin(kx) <= -0.02: tmp = ky * (math.sin(th) / math.fabs(math.sin(kx))) elif math.sin(kx) <= 4e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif math.sin(kx) <= 0.78: tmp = math.sin(ky) * t_2 elif math.sin(kx) <= 0.9: tmp = t_1 else: tmp = t_2 / (1.0 / math.sin(ky)) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)) t_2 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.77) tmp = t_1; elseif (sin(kx) <= -0.02) tmp = Float64(ky * Float64(sin(th) / abs(sin(kx)))); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (sin(kx) <= 0.78) tmp = Float64(sin(ky) * t_2); elseif (sin(kx) <= 0.9) tmp = t_1; else tmp = Float64(t_2 / Float64(1.0 / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / (hypot(sin(kx), sin(ky)) / th); t_2 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.77) tmp = t_1; elseif (sin(kx) <= -0.02) tmp = ky * (sin(th) / abs(sin(kx))); elseif (sin(kx) <= 4e-7) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (sin(kx) <= 0.78) tmp = sin(ky) * t_2; elseif (sin(kx) <= 0.9) tmp = t_1; else tmp = t_2 / (1.0 / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.77], t$95$1, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.78], N[(N[Sin[ky], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.9], t$95$1, N[(t$95$2 / N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
t_2 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.77:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin kx \leq 0.78:\\
\;\;\;\;\sin ky \cdot t_2\\
\mathbf{elif}\;\sin kx \leq 0.9:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{\frac{1}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.77000000000000002 or 0.78000000000000003 < (sin.f64 kx) < 0.900000000000000022Initial program 99.4%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 54.2%
associate-*r/54.2%
unpow254.2%
unpow254.2%
hypot-def54.3%
*-rgt-identity54.3%
hypot-def54.2%
unpow254.2%
unpow254.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-def54.3%
Simplified54.3%
if -0.77000000000000002 < (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 8.3%
associate-/l*8.3%
associate-/r/8.3%
Simplified8.3%
add-sqr-sqrt0.0%
sqrt-prod49.6%
rem-sqrt-square49.6%
Applied egg-rr49.6%
if -0.0200000000000000004 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 99.9%
if 3.9999999999999998e-7 < (sin.f64 kx) < 0.78000000000000003Initial program 99.5%
associate-*l/99.5%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 83.4%
if 0.900000000000000022 < (sin.f64 kx) Initial program 99.7%
associate-*l/99.6%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.7%
Simplified99.7%
clear-num99.4%
associate-/r/99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/99.7%
*-un-lft-identity99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 60.6%
Final simplification80.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.77)
(/ (* (sin ky) th) (hypot (sin ky) (sin kx)))
(if (<= (sin kx) -0.02)
(* ky (/ (sin th) (fabs (sin kx))))
(if (<= (sin kx) 4e-7)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= (sin kx) 0.78)
(* (sin ky) t_1)
(if (<= (sin kx) 0.9)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(/ t_1 (/ 1.0 (sin ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.77) {
tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= -0.02) {
tmp = ky * (sin(th) / fabs(sin(kx)));
} else if (sin(kx) <= 4e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (sin(kx) <= 0.78) {
tmp = sin(ky) * t_1;
} else if (sin(kx) <= 0.9) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = t_1 / (1.0 / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.77) {
tmp = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= -0.02) {
tmp = ky * (Math.sin(th) / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 4e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(kx) <= 0.78) {
tmp = Math.sin(ky) * t_1;
} else if (Math.sin(kx) <= 0.9) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = t_1 / (1.0 / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.77: tmp = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= -0.02: tmp = ky * (math.sin(th) / math.fabs(math.sin(kx))) elif math.sin(kx) <= 4e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif math.sin(kx) <= 0.78: tmp = math.sin(ky) * t_1 elif math.sin(kx) <= 0.9: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = t_1 / (1.0 / math.sin(ky)) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.77) tmp = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= -0.02) tmp = Float64(ky * Float64(sin(th) / abs(sin(kx)))); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (sin(kx) <= 0.78) tmp = Float64(sin(ky) * t_1); elseif (sin(kx) <= 0.9) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(t_1 / Float64(1.0 / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.77) tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= -0.02) tmp = ky * (sin(th) / abs(sin(kx))); elseif (sin(kx) <= 4e-7) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (sin(kx) <= 0.78) tmp = sin(ky) * t_1; elseif (sin(kx) <= 0.9) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = t_1 / (1.0 / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.77], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.78], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.9], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.77:\\
\;\;\;\;\frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin kx \leq 0.78:\\
\;\;\;\;\sin ky \cdot t_1\\
\mathbf{elif}\;\sin kx \leq 0.9:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{\frac{1}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.77000000000000002Initial program 99.4%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 53.5%
if -0.77000000000000002 < (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 8.3%
associate-/l*8.3%
associate-/r/8.3%
Simplified8.3%
add-sqr-sqrt0.0%
sqrt-prod49.6%
rem-sqrt-square49.6%
Applied egg-rr49.6%
if -0.0200000000000000004 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 99.9%
if 3.9999999999999998e-7 < (sin.f64 kx) < 0.78000000000000003Initial program 99.5%
associate-*l/99.5%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 83.4%
if 0.78000000000000003 < (sin.f64 kx) < 0.900000000000000022Initial program 99.4%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 58.0%
associate-*r/58.0%
unpow258.0%
unpow258.0%
hypot-def58.3%
*-rgt-identity58.3%
hypot-def58.0%
unpow258.0%
unpow258.0%
+-commutative58.0%
unpow258.0%
unpow258.0%
hypot-def58.3%
Simplified58.3%
if 0.900000000000000022 < (sin.f64 kx) Initial program 99.7%
associate-*l/99.6%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.7%
Simplified99.7%
clear-num99.4%
associate-/r/99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/99.7%
*-un-lft-identity99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 60.6%
Final simplification80.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.68)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(if (<= (sin ky) -0.0005)
(* (sin th) (* (sin ky) (fabs (/ 1.0 (sin ky)))))
(if (<= (sin ky) 0.0001)
(/ (/ (sin th) t_1) (+ (* ky 0.16666666666666666) (/ 1.0 ky)))
(sin th))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.68) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (sin(ky) <= -0.0005) {
tmp = sin(th) * (sin(ky) * fabs((1.0 / sin(ky))));
} else if (sin(ky) <= 0.0001) {
tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.68) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (Math.sin(ky) <= -0.0005) {
tmp = Math.sin(th) * (Math.sin(ky) * Math.abs((1.0 / Math.sin(ky))));
} else if (Math.sin(ky) <= 0.0001) {
tmp = (Math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.68: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) elif math.sin(ky) <= -0.0005: tmp = math.sin(th) * (math.sin(ky) * math.fabs((1.0 / math.sin(ky)))) elif math.sin(ky) <= 0.0001: tmp = (math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.68) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); elseif (sin(ky) <= -0.0005) tmp = Float64(sin(th) * Float64(sin(ky) * abs(Float64(1.0 / sin(ky))))); elseif (sin(ky) <= 0.0001) tmp = Float64(Float64(sin(th) / t_1) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.68) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); elseif (sin(ky) <= -0.0005) tmp = sin(th) * (sin(ky) * abs((1.0 / sin(ky)))); elseif (sin(ky) <= 0.0001) tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)); else tmp = sin(th); 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]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.68], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0001], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.68:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq -0.0005:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \left|\frac{1}{\sin ky}\right|\right)\\
\mathbf{elif}\;\sin ky \leq 0.0001:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.680000000000000049Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.4%
div-inv99.3%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 55.4%
*-commutative55.4%
Simplified55.4%
if -0.680000000000000049 < (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.8%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.8%
associate-*r/2.8%
*-commutative2.8%
div-inv2.8%
associate-*l*2.8%
Applied egg-rr2.8%
add-sqr-sqrt0.0%
sqrt-unprod72.5%
inv-pow72.5%
inv-pow72.5%
pow-prod-up72.5%
metadata-eval72.5%
Applied egg-rr72.5%
metadata-eval72.5%
pow-sqr72.5%
unpow-172.5%
unpow-172.5%
rem-sqrt-square72.5%
Simplified72.5%
if -5.0000000000000001e-4 < (sin.f64 ky) < 1.00000000000000005e-4Initial program 86.6%
associate-*l/83.7%
associate-*r/86.6%
+-commutative86.6%
unpow286.6%
unpow286.6%
hypot-def99.6%
Simplified99.6%
clear-num99.5%
associate-/r/99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/99.6%
*-un-lft-identity99.6%
associate-/r/99.6%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.5%
if 1.00000000000000005e-4 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 69.9%
Final simplification83.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin ky) -1e-5)
t_1
(if (<= (sin ky) -2e-153)
(/ (* ky (sin th)) kx)
(if (<= (sin ky) -1e-175)
(- th)
(if (<= (sin ky) -2e-205)
t_1
(if (<= (sin ky) 5e-97) (/ (sin th) (/ kx ky)) (sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(ky) <= -1e-5) {
tmp = t_1;
} else if (sin(ky) <= -2e-153) {
tmp = (ky * sin(th)) / kx;
} else if (sin(ky) <= -1e-175) {
tmp = -th;
} else if (sin(ky) <= -2e-205) {
tmp = t_1;
} else if (sin(ky) <= 5e-97) {
tmp = sin(th) / (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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (sin(ky) <= (-1d-5)) then
tmp = t_1
else if (sin(ky) <= (-2d-153)) then
tmp = (ky * sin(th)) / kx
else if (sin(ky) <= (-1d-175)) then
tmp = -th
else if (sin(ky) <= (-2d-205)) then
tmp = t_1
else if (sin(ky) <= 5d-97) then
tmp = sin(th) / (kx / ky)
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(th));
double tmp;
if (Math.sin(ky) <= -1e-5) {
tmp = t_1;
} else if (Math.sin(ky) <= -2e-153) {
tmp = (ky * Math.sin(th)) / kx;
} else if (Math.sin(ky) <= -1e-175) {
tmp = -th;
} else if (Math.sin(ky) <= -2e-205) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-97) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(ky) <= -1e-5: tmp = t_1 elif math.sin(ky) <= -2e-153: tmp = (ky * math.sin(th)) / kx elif math.sin(ky) <= -1e-175: tmp = -th elif math.sin(ky) <= -2e-205: tmp = t_1 elif math.sin(ky) <= 5e-97: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = t_1; elseif (sin(ky) <= -2e-153) tmp = Float64(Float64(ky * sin(th)) / kx); elseif (sin(ky) <= -1e-175) tmp = Float64(-th); elseif (sin(ky) <= -2e-205) tmp = t_1; elseif (sin(ky) <= 5e-97) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(ky) <= -1e-5) tmp = t_1; elseif (sin(ky) <= -2e-153) tmp = (ky * sin(th)) / kx; elseif (sin(ky) <= -1e-175) tmp = -th; elseif (sin(ky) <= -2e-205) tmp = t_1; elseif (sin(ky) <= 5e-97) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-5], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-153], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-175], (-th), If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-205], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-97], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-153}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-175}:\\
\;\;\;\;-th\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5 or -1e-175 < (sin.f64 ky) < -2e-205Initial program 96.9%
associate-*l/96.7%
associate-*r/96.7%
+-commutative96.7%
unpow296.7%
unpow296.7%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.4%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
*-commutative25.7%
associate-/r/25.8%
*-inverses25.8%
/-rgt-identity25.8%
unpow225.8%
rem-sqrt-square31.6%
Simplified31.6%
if -1.00000000000000008e-5 < (sin.f64 ky) < -2.00000000000000008e-153Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 42.4%
associate-/l*42.2%
associate-/r/42.2%
Simplified42.2%
Taylor expanded in kx around 0 12.6%
if -2.00000000000000008e-153 < (sin.f64 ky) < -1e-175Initial program 2.4%
associate-*l/2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-def76.4%
Simplified76.4%
Taylor expanded in kx around 0 3.1%
Taylor expanded in th around 0 3.1%
associate-/l*2.7%
associate-/r/2.7%
*-un-lft-identity2.7%
associate-*l/2.7%
lft-mult-inverse2.7%
*-un-lft-identity2.7%
add-sqr-sqrt2.2%
sqrt-unprod27.6%
Applied egg-rr27.6%
Taylor expanded in th around -inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -2e-205 < (sin.f64 ky) < 4.9999999999999995e-97Initial program 82.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 62.4%
associate-/l*64.8%
associate-/r/64.7%
Simplified64.7%
Taylor expanded in kx around 0 45.6%
associate-/l*48.0%
Simplified48.0%
if 4.9999999999999995e-97 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.0%
Final simplification44.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(* ky (/ (sin th) (fabs (sin kx))))
(if (<= (sin kx) 4e-7)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * (sin(th) / fabs(sin(kx)));
} else if (sin(kx) <= 4e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * (Math.sin(th) / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 4e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * (math.sin(th) / math.fabs(math.sin(kx))) elif math.sin(kx) <= 4e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * Float64(sin(th) / abs(sin(kx)))); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * (sin(th) / abs(sin(kx))); elseif (sin(kx) <= 4e-7) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 12.1%
associate-/l*12.1%
associate-/r/12.1%
Simplified12.1%
add-sqr-sqrt0.0%
sqrt-prod47.9%
rem-sqrt-square47.9%
Applied egg-rr47.9%
if -0.0200000000000000004 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 99.9%
if 3.9999999999999998e-7 < (sin.f64 kx) Initial program 99.5%
associate-*l/99.4%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 71.7%
Final simplification79.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0006) (fabs (sin th)) (if (<= (sin ky) 1e-14) (* ky (/ (sin th) (fabs (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0006) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-14) {
tmp = ky * (sin(th) / 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) <= (-0.0006d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-14) then
tmp = ky * (sin(th) / 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) <= -0.0006) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-14) {
tmp = ky * (Math.sin(th) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0006: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-14: tmp = ky * (math.sin(th) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0006) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-14) tmp = Float64(ky * Float64(sin(th) / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0006) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-14) tmp = ky * (sin(th) / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0006], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-14], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0006:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-14}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.99999999999999947e-4Initial program 99.7%
associate-*l/99.6%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.4%
sqrt-unprod25.4%
pow225.4%
Applied egg-rr25.4%
*-commutative25.4%
associate-/r/25.4%
*-inverses25.4%
/-rgt-identity25.4%
unpow225.4%
rem-sqrt-square32.0%
Simplified32.0%
if -5.99999999999999947e-4 < (sin.f64 ky) < 9.99999999999999999e-15Initial program 86.3%
+-commutative86.3%
unpow286.3%
unpow286.3%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.3%
associate-/l*49.5%
associate-/r/49.4%
Simplified49.4%
add-sqr-sqrt42.1%
sqrt-prod73.5%
rem-sqrt-square79.3%
Applied egg-rr79.3%
if 9.99999999999999999e-15 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 69.1%
Final simplification65.4%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.9%
associate-*l/91.3%
associate-*r/92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= th -350.0)
(/ (* ky (sin th)) t_1)
(if (<= th 0.054)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (th <= -350.0) {
tmp = (ky * sin(th)) / t_1;
} else if (th <= 0.054) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (th <= -350.0) {
tmp = (ky * Math.sin(th)) / t_1;
} else if (th <= 0.054) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if th <= -350.0: tmp = (ky * math.sin(th)) / t_1 elif th <= 0.054: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) else: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (th <= -350.0) tmp = Float64(Float64(ky * sin(th)) / t_1); elseif (th <= 0.054) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (th <= -350.0) tmp = (ky * sin(th)) / t_1; elseif (th <= 0.054) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); else tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); 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]}, If[LessEqual[th, -350.0], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[th, 0.054], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq -350:\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{elif}\;th \leq 0.054:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\end{array}
\end{array}
if th < -350Initial program 92.0%
associate-*l/92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 64.5%
if -350 < th < 0.0539999999999999994Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.6%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 98.6%
*-commutative98.6%
Simplified98.6%
if 0.0539999999999999994 < th Initial program 97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.0%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(if (<= th -350.0)
(/ (* ky (sin th)) (hypot (sin ky) (sin kx)))
(if (<= th 0.00033)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(* (sin th) (/ (sin ky) (hypot (sin ky) kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= -350.0) {
tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx));
} else if (th <= 0.00033) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= -350.0) {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (th <= 0.00033) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= -350.0: tmp = (ky * math.sin(th)) / math.hypot(math.sin(ky), math.sin(kx)) elif th <= 0.00033: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= -350.0) tmp = Float64(Float64(ky * sin(th)) / hypot(sin(ky), sin(kx))); elseif (th <= 0.00033) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= -350.0) tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx)); elseif (th <= 0.00033) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, -350.0], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 0.00033], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -350:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 0.00033:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\end{array}
\end{array}
if th < -350Initial program 92.0%
associate-*l/92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 64.5%
if -350 < th < 3.3e-4Initial program 91.3%
associate-/r/91.2%
+-commutative91.2%
unpow291.2%
unpow291.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 89.7%
associate-*r/89.8%
unpow289.8%
unpow289.8%
hypot-def98.3%
*-rgt-identity98.3%
hypot-def89.8%
unpow289.8%
unpow289.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-def98.3%
Simplified98.3%
if 3.3e-4 < th Initial program 97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.0%
Final simplification79.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-31) (fabs (sin th)) (if (<= (sin ky) 5e-97) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-31) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-97) {
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) <= (-5d-31)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-97) 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) <= -5e-31) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-97) {
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) <= -5e-31: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-97: 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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], -5e-31], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-97], 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 -5 \cdot 10^{-31}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-31Initial program 99.7%
associate-*l/99.5%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.4%
sqrt-unprod23.9%
pow223.9%
Applied egg-rr23.9%
*-commutative23.9%
associate-/r/24.0%
*-inverses24.0%
/-rgt-identity24.0%
unpow224.0%
rem-sqrt-square30.3%
Simplified30.3%
if -5e-31 < (sin.f64 ky) < 4.9999999999999995e-97Initial program 82.9%
+-commutative82.9%
unpow282.9%
unpow282.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.9%
if 4.9999999999999995e-97 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.0%
Final simplification50.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-31) (fabs (sin th)) (if (<= (sin ky) 5e-97) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-31) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-97) {
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) <= (-5d-31)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-97) 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) <= -5e-31) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-97) {
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) <= -5e-31: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-97: 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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], -5e-31], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-97], 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 -5 \cdot 10^{-31}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-31Initial program 99.7%
associate-*l/99.5%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.4%
sqrt-unprod23.9%
pow223.9%
Applied egg-rr23.9%
*-commutative23.9%
associate-/r/24.0%
*-inverses24.0%
/-rgt-identity24.0%
unpow224.0%
rem-sqrt-square30.3%
Simplified30.3%
if -5e-31 < (sin.f64 ky) < 4.9999999999999995e-97Initial program 82.9%
+-commutative82.9%
unpow282.9%
unpow282.9%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 52.4%
associate-/l*53.9%
associate-/r/53.8%
Simplified53.8%
if 4.9999999999999995e-97 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.0%
Final simplification50.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-31) (fabs (sin th)) (if (<= (sin ky) 5e-97) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-31) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-97) {
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) <= (-5d-31)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-97) 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) <= -5e-31) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-97) {
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) <= -5e-31: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-97: 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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) <= -5e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-97) 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], -5e-31], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-97], 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 -5 \cdot 10^{-31}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-31Initial program 99.7%
associate-*l/99.5%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.4%
sqrt-unprod23.9%
pow223.9%
Applied egg-rr23.9%
*-commutative23.9%
associate-/r/24.0%
*-inverses24.0%
/-rgt-identity24.0%
unpow224.0%
rem-sqrt-square30.3%
Simplified30.3%
if -5e-31 < (sin.f64 ky) < 4.9999999999999995e-97Initial program 82.9%
+-commutative82.9%
unpow282.9%
unpow282.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.4%
associate-/l*53.9%
Simplified53.9%
if 4.9999999999999995e-97 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.0%
Final simplification50.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (/ th (sin kx)))))
(if (<= ky -580000000.0)
(sin th)
(if (<= ky -3.9e-163)
t_1
(if (<= ky -1.45e-214) (- th) (if (<= ky 1.5e-96) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = ky * (th / sin(kx));
double tmp;
if (ky <= -580000000.0) {
tmp = sin(th);
} else if (ky <= -3.9e-163) {
tmp = t_1;
} else if (ky <= -1.45e-214) {
tmp = -th;
} else if (ky <= 1.5e-96) {
tmp = t_1;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = ky * (th / sin(kx))
if (ky <= (-580000000.0d0)) then
tmp = sin(th)
else if (ky <= (-3.9d-163)) then
tmp = t_1
else if (ky <= (-1.45d-214)) then
tmp = -th
else if (ky <= 1.5d-96) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky * (th / Math.sin(kx));
double tmp;
if (ky <= -580000000.0) {
tmp = Math.sin(th);
} else if (ky <= -3.9e-163) {
tmp = t_1;
} else if (ky <= -1.45e-214) {
tmp = -th;
} else if (ky <= 1.5e-96) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * (th / math.sin(kx)) tmp = 0 if ky <= -580000000.0: tmp = math.sin(th) elif ky <= -3.9e-163: tmp = t_1 elif ky <= -1.45e-214: tmp = -th elif ky <= 1.5e-96: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky * Float64(th / sin(kx))) tmp = 0.0 if (ky <= -580000000.0) tmp = sin(th); elseif (ky <= -3.9e-163) tmp = t_1; elseif (ky <= -1.45e-214) tmp = Float64(-th); elseif (ky <= 1.5e-96) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky * (th / sin(kx)); tmp = 0.0; if (ky <= -580000000.0) tmp = sin(th); elseif (ky <= -3.9e-163) tmp = t_1; elseif (ky <= -1.45e-214) tmp = -th; elseif (ky <= 1.5e-96) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, -580000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -3.9e-163], t$95$1, If[LessEqual[ky, -1.45e-214], (-th), If[LessEqual[ky, 1.5e-96], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \frac{th}{\sin kx}\\
\mathbf{if}\;ky \leq -580000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -3.9 \cdot 10^{-163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1.45 \cdot 10^{-214}:\\
\;\;\;\;-th\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.8e8 or 1.5e-96 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 38.0%
if -5.8e8 < ky < -3.9000000000000002e-163 or -1.44999999999999993e-214 < ky < 1.5e-96Initial program 89.0%
+-commutative89.0%
unpow289.0%
unpow289.0%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 53.8%
associate-/l*55.3%
associate-/r/55.3%
Simplified55.3%
Taylor expanded in th around 0 31.0%
if -3.9000000000000002e-163 < ky < -1.44999999999999993e-214Initial program 42.8%
associate-*l/42.6%
+-commutative42.6%
unpow242.6%
unpow242.6%
hypot-def83.9%
Simplified83.9%
Taylor expanded in kx around 0 2.6%
Taylor expanded in th around 0 2.6%
associate-/l*2.2%
associate-/r/2.4%
*-un-lft-identity2.4%
associate-*l/2.4%
lft-mult-inverse2.4%
*-un-lft-identity2.4%
add-sqr-sqrt1.2%
sqrt-unprod10.9%
Applied egg-rr10.9%
Taylor expanded in th around -inf 43.0%
neg-mul-143.0%
Simplified43.0%
Final simplification35.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -840000000.0) (sin th) (if (<= ky 1.05e-96) (* ky (/ (sin th) kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -840000000.0) {
tmp = sin(th);
} else if (ky <= 1.05e-96) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-840000000.0d0)) then
tmp = sin(th)
else if (ky <= 1.05d-96) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -840000000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.05e-96) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -840000000.0: tmp = math.sin(th) elif ky <= 1.05e-96: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= 1.05e-96) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= 1.05e-96) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -840000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e-96], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -840000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{-96}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8.4e8 or 1.05000000000000001e-96 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 38.0%
if -8.4e8 < ky < 1.05000000000000001e-96Initial program 83.9%
+-commutative83.9%
unpow283.9%
unpow283.9%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 49.3%
associate-/l*50.6%
associate-/r/50.6%
Simplified50.6%
Taylor expanded in kx around 0 32.4%
Final simplification35.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -840000000.0) (sin th) (if (<= ky 8e-96) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -840000000.0) {
tmp = sin(th);
} else if (ky <= 8e-96) {
tmp = sin(th) / (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 (ky <= (-840000000.0d0)) then
tmp = sin(th)
else if (ky <= 8d-96) then
tmp = sin(th) / (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 (ky <= -840000000.0) {
tmp = Math.sin(th);
} else if (ky <= 8e-96) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -840000000.0: tmp = math.sin(th) elif ky <= 8e-96: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= 8e-96) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= 8e-96) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -840000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 8e-96], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -840000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{-96}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8.4e8 or 7.9999999999999993e-96 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 38.0%
if -8.4e8 < ky < 7.9999999999999993e-96Initial program 83.9%
+-commutative83.9%
unpow283.9%
unpow283.9%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 49.3%
associate-/l*50.6%
associate-/r/50.6%
Simplified50.6%
Taylor expanded in kx around 0 31.1%
associate-/l*32.4%
Simplified32.4%
Final simplification35.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -840000000.0) (sin th) (if (<= ky -4.5e-296) (- th) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -840000000.0) {
tmp = sin(th);
} else if (ky <= -4.5e-296) {
tmp = -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 <= (-840000000.0d0)) then
tmp = sin(th)
else if (ky <= (-4.5d-296)) then
tmp = -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 <= -840000000.0) {
tmp = Math.sin(th);
} else if (ky <= -4.5e-296) {
tmp = -th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -840000000.0: tmp = math.sin(th) elif ky <= -4.5e-296: tmp = -th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= -4.5e-296) tmp = Float64(-th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -840000000.0) tmp = sin(th); elseif (ky <= -4.5e-296) tmp = -th; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -840000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -4.5e-296], (-th), N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -840000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -4.5 \cdot 10^{-296}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8.4e8 or -4.5000000000000002e-296 < ky Initial program 96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 32.9%
if -8.4e8 < ky < -4.5000000000000002e-296Initial program 82.1%
associate-*l/78.7%
+-commutative78.7%
unpow278.7%
unpow278.7%
hypot-def89.3%
Simplified89.3%
Taylor expanded in kx around 0 11.4%
Taylor expanded in th around 0 11.8%
associate-/l*3.2%
associate-/r/3.3%
*-un-lft-identity3.3%
associate-*l/3.3%
lft-mult-inverse3.3%
*-un-lft-identity3.3%
add-sqr-sqrt1.2%
sqrt-unprod11.6%
Applied egg-rr11.6%
Taylor expanded in th around -inf 15.9%
neg-mul-115.9%
Simplified15.9%
Final simplification28.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.5e-6) (sin th) (sqrt (* th th))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.5e-6) {
tmp = sin(th);
} else {
tmp = sqrt((th * 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 (kx <= 3.5d-6) then
tmp = sin(th)
else
tmp = sqrt((th * th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.5e-6) {
tmp = Math.sin(th);
} else {
tmp = Math.sqrt((th * th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.5e-6: tmp = math.sin(th) else: tmp = math.sqrt((th * th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.5e-6) tmp = sin(th); else tmp = sqrt(Float64(th * th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.5e-6) tmp = sin(th); else tmp = sqrt((th * th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.5e-6], N[Sin[th], $MachinePrecision], N[Sqrt[N[(th * th), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.5 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sqrt{th \cdot th}\\
\end{array}
\end{array}
if kx < 3.49999999999999995e-6Initial program 90.9%
+-commutative90.9%
unpow290.9%
unpow290.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.1%
if 3.49999999999999995e-6 < kx Initial program 99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 15.9%
Taylor expanded in th around 0 15.2%
associate-/l*4.3%
associate-/r/4.4%
*-un-lft-identity4.4%
associate-*l/4.4%
lft-mult-inverse4.4%
*-un-lft-identity4.4%
add-sqr-sqrt1.8%
sqrt-unprod14.7%
Applied egg-rr14.7%
Final simplification27.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.55e-298) (- th) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.55e-298) {
tmp = -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.55d-298)) then
tmp = -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.55e-298) {
tmp = -th;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.55e-298: tmp = -th else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.55e-298) tmp = Float64(-th); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.55e-298) tmp = -th; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.55e-298], (-th), th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.55 \cdot 10^{-298}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.5500000000000001e-298Initial program 89.9%
associate-*l/88.0%
+-commutative88.0%
unpow288.0%
unpow288.0%
hypot-def93.9%
Simplified93.9%
Taylor expanded in kx around 0 20.4%
Taylor expanded in th around 0 11.7%
associate-/l*6.9%
associate-/r/6.9%
*-un-lft-identity6.9%
associate-*l/6.9%
lft-mult-inverse6.9%
*-un-lft-identity6.9%
add-sqr-sqrt3.5%
sqrt-unprod10.4%
Applied egg-rr10.4%
Taylor expanded in th around -inf 17.1%
neg-mul-117.1%
Simplified17.1%
if -1.5500000000000001e-298 < ky Initial program 95.6%
associate-*l/94.3%
associate-*r/95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.3%
Taylor expanded in th around 0 15.7%
Final simplification16.4%
(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.9%
associate-*l/91.3%
associate-*r/92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 25.0%
Taylor expanded in th around 0 11.6%
Final simplification11.6%
herbie shell --seed 2023260
(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)))