
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(- (sin th))
(if (<= (sin ky) 0.0002)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else if (sin(ky) <= 0.0002) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 0.0002) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = -math.sin(th) elif math.sin(ky) <= 0.0002: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(-sin(th)); elseif (sin(ky) <= 0.0002) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = -sin(th); elseif (sin(ky) <= 0.0002) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 7.4%
Taylor expanded in ky around -inf 6.0%
associate-*r/6.0%
neg-mul-16.0%
distribute-lft-neg-in6.0%
*-commutative6.0%
Simplified6.0%
Taylor expanded in ky around 0 57.9%
mul-1-neg57.9%
Simplified57.9%
if -0.0050000000000000001 < (sin.f64 ky) < 2.0000000000000001e-4Initial program 89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 99.5%
if 2.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 64.6%
Final simplification79.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (- (sin th)) (if (<= (sin ky) 0.0002) (* (sin th) (/ ky (hypot ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else if (sin(ky) <= 0.0002) {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 0.0002) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = -math.sin(th) elif math.sin(ky) <= 0.0002: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(-sin(th)); elseif (sin(ky) <= 0.0002) tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = -sin(th); elseif (sin(ky) <= 0.0002) tmp = sin(th) * (ky / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 7.4%
Taylor expanded in ky around -inf 6.0%
associate-*r/6.0%
neg-mul-16.0%
distribute-lft-neg-in6.0%
*-commutative6.0%
Simplified6.0%
Taylor expanded in ky around 0 57.9%
mul-1-neg57.9%
Simplified57.9%
if -0.0050000000000000001 < (sin.f64 ky) < 2.0000000000000001e-4Initial program 89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 99.5%
Taylor expanded in ky around 0 99.3%
if 2.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 64.6%
Final simplification79.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-36) (- (sin th)) (if (<= (sin ky) 2e-36) (* (sin th) (/ ky (fabs (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-36) {
tmp = -sin(th);
} else if (sin(ky) <= 2e-36) {
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-36)) then
tmp = -sin(th)
else if (sin(ky) <= 2d-36) 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-36) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 2e-36) {
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-36: tmp = -math.sin(th) elif math.sin(ky) <= 2e-36: 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-36) tmp = Float64(-sin(th)); elseif (sin(ky) <= 2e-36) 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-36) tmp = -sin(th); elseif (sin(ky) <= 2e-36) 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-36], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-36], 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^{-36}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000004e-36Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 11.1%
Taylor expanded in ky around -inf 8.6%
associate-*r/8.6%
neg-mul-18.6%
distribute-lft-neg-in8.6%
*-commutative8.6%
Simplified8.6%
Taylor expanded in ky around 0 58.4%
mul-1-neg58.4%
Simplified58.4%
if -5.00000000000000004e-36 < (sin.f64 ky) < 1.9999999999999999e-36Initial program 88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 47.2%
add-sqr-sqrt37.3%
sqrt-prod74.0%
rem-sqrt-square78.0%
Applied egg-rr78.0%
if 1.9999999999999999e-36 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 65.2%
Final simplification68.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-36) (- (sin th)) (if (<= (sin ky) 2e-36) (/ ky (/ (fabs (sin kx)) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-36) {
tmp = -sin(th);
} else if (sin(ky) <= 2e-36) {
tmp = ky / (fabs(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) <= (-5d-36)) then
tmp = -sin(th)
else if (sin(ky) <= 2d-36) then
tmp = ky / (abs(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) <= -5e-36) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 2e-36) {
tmp = ky / (Math.abs(Math.sin(kx)) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-36: tmp = -math.sin(th) elif math.sin(ky) <= 2e-36: tmp = ky / (math.fabs(math.sin(kx)) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-36) tmp = Float64(-sin(th)); elseif (sin(ky) <= 2e-36) tmp = Float64(ky / Float64(abs(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) <= -5e-36) tmp = -sin(th); elseif (sin(ky) <= 2e-36) tmp = ky / (abs(sin(kx)) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-36], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-36], N[(ky / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-36}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\frac{ky}{\frac{\left|\sin kx\right|}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000004e-36Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 11.1%
Taylor expanded in ky around -inf 8.6%
associate-*r/8.6%
neg-mul-18.6%
distribute-lft-neg-in8.6%
*-commutative8.6%
Simplified8.6%
Taylor expanded in ky around 0 58.4%
mul-1-neg58.4%
Simplified58.4%
if -5.00000000000000004e-36 < (sin.f64 ky) < 1.9999999999999999e-36Initial program 88.6%
Taylor expanded in ky around 0 44.8%
*-commutative44.8%
associate-/l*47.2%
Simplified47.2%
add-sqr-sqrt37.3%
sqrt-prod74.0%
rem-sqrt-square78.0%
Applied egg-rr78.2%
if 1.9999999999999999e-36 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 65.2%
Final simplification68.9%
(FPCore (kx ky th) :precision binary64 (if (or (<= th -4e-5) (not (<= th 3.7e-29))) (* (sin th) (/ ky (hypot ky (sin kx)))) (* th (/ (sin ky) (hypot (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if ((th <= -4e-5) || !(th <= 3.7e-29)) {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
} else {
tmp = th * (sin(ky) / hypot(sin(kx), sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((th <= -4e-5) || !(th <= 3.7e-29)) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (th <= -4e-5) or not (th <= 3.7e-29): tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) else: tmp = th * (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((th <= -4e-5) || !(th <= 3.7e-29)) tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); else tmp = Float64(th * Float64(sin(ky) / hypot(sin(kx), sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((th <= -4e-5) || ~((th <= 3.7e-29))) tmp = sin(th) * (ky / hypot(ky, sin(kx))); else tmp = th * (sin(ky) / hypot(sin(kx), sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[th, -4e-5], N[Not[LessEqual[th, 3.7e-29]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -4 \cdot 10^{-5} \lor \neg \left(th \leq 3.7 \cdot 10^{-29}\right):\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\end{array}
\end{array}
if th < -4.00000000000000033e-5 or 3.6999999999999997e-29 < th Initial program 95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 56.7%
Taylor expanded in ky around 0 70.6%
if -4.00000000000000033e-5 < th < 3.6999999999999997e-29Initial program 94.4%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
+-commutative94.3%
Simplified99.7%
Taylor expanded in th around 0 94.2%
associate-*r/94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
*-rgt-identity99.7%
hypot-def94.3%
unpow294.3%
unpow294.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
associate-/r/99.8%
hypot-udef94.4%
+-commutative94.4%
hypot-udef99.8%
add-sqr-sqrt99.3%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification83.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -1.75e-153)
(/ (* ky t_1) ky)
(if (<= ky 1.15e-38) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -1.75e-153) {
tmp = (ky * t_1) / ky;
} else if (ky <= 1.15e-38) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-1.75d-153)) then
tmp = (ky * t_1) / ky
else if (ky <= 1.15d-38) 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 t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -1.75e-153) {
tmp = (ky * t_1) / ky;
} else if (ky <= 1.15e-38) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -1.75e-153: tmp = (ky * t_1) / ky elif ky <= 1.15e-38: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.75e-153) tmp = Float64(Float64(ky * t_1) / ky); elseif (ky <= 1.15e-38) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.75e-153) tmp = (ky * t_1) / ky; elseif (ky <= 1.15e-38) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.75e-153], N[(N[(ky * t$95$1), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[ky, 1.15e-38], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.75 \cdot 10^{-153}:\\
\;\;\;\;\frac{ky \cdot t_1}{ky}\\
\mathbf{elif}\;ky \leq 1.15 \cdot 10^{-38}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.5%
Taylor expanded in ky around -inf 4.5%
associate-*r/4.5%
neg-mul-14.5%
distribute-lft-neg-in4.5%
*-commutative4.5%
Simplified4.5%
Taylor expanded in ky around 0 38.0%
mul-1-neg38.0%
Simplified38.0%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 1.15000000000000001e-38 < ky Initial program 99.7%
Taylor expanded in kx around 0 42.9%
if -2.1999999999999999e136 < ky < -1.7499999999999999e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around -inf 25.2%
associate-*r/25.2%
neg-mul-125.2%
distribute-lft-neg-in25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in ky around 0 43.5%
neg-mul-143.5%
distribute-rgt-neg-in43.5%
Simplified43.5%
if -1.7499999999999999e-153 < ky < 1.15000000000000001e-38Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 54.2%
Final simplification46.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -1.2e-152)
(/ (* ky t_1) ky)
(if (<= ky 3.8e-38) (* ky (/ (sin th) (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -1.2e-152) {
tmp = (ky * t_1) / ky;
} else if (ky <= 3.8e-38) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-1.2d-152)) then
tmp = (ky * t_1) / ky
else if (ky <= 3.8d-38) 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 t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -1.2e-152) {
tmp = (ky * t_1) / ky;
} else if (ky <= 3.8e-38) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -1.2e-152: tmp = (ky * t_1) / ky elif ky <= 3.8e-38: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.2e-152) tmp = Float64(Float64(ky * t_1) / ky); elseif (ky <= 3.8e-38) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.2e-152) tmp = (ky * t_1) / ky; elseif (ky <= 3.8e-38) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.2e-152], N[(N[(ky * t$95$1), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[ky, 3.8e-38], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.2 \cdot 10^{-152}:\\
\;\;\;\;\frac{ky \cdot t_1}{ky}\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-38}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.5%
Taylor expanded in ky around -inf 4.5%
associate-*r/4.5%
neg-mul-14.5%
distribute-lft-neg-in4.5%
*-commutative4.5%
Simplified4.5%
Taylor expanded in ky around 0 38.0%
mul-1-neg38.0%
Simplified38.0%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 3.8e-38 < ky Initial program 99.7%
Taylor expanded in kx around 0 42.9%
if -2.1999999999999999e136 < ky < -1.2e-152Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around -inf 25.2%
associate-*r/25.2%
neg-mul-125.2%
distribute-lft-neg-in25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in ky around 0 43.5%
neg-mul-143.5%
distribute-rgt-neg-in43.5%
Simplified43.5%
if -1.2e-152 < ky < 3.8e-38Initial program 85.7%
Taylor expanded in ky around 0 51.2%
*-commutative51.2%
associate-/l*54.3%
Simplified54.3%
clear-num54.1%
associate-/r/54.3%
clear-num54.2%
Applied egg-rr54.2%
Final simplification46.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -7.2e-153)
(/ (* ky t_1) ky)
(if (<= ky 7.5e-38) (/ ky (/ (sin kx) (sin th))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -7.2e-153) {
tmp = (ky * t_1) / ky;
} else if (ky <= 7.5e-38) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-7.2d-153)) then
tmp = (ky * t_1) / ky
else if (ky <= 7.5d-38) 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 t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -7.2e-153) {
tmp = (ky * t_1) / ky;
} else if (ky <= 7.5e-38) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -7.2e-153: tmp = (ky * t_1) / ky elif ky <= 7.5e-38: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -7.2e-153) tmp = Float64(Float64(ky * t_1) / ky); elseif (ky <= 7.5e-38) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -7.2e-153) tmp = (ky * t_1) / ky; elseif (ky <= 7.5e-38) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -7.2e-153], N[(N[(ky * t$95$1), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[ky, 7.5e-38], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -7.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{ky \cdot t_1}{ky}\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-38}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.5%
Taylor expanded in ky around -inf 4.5%
associate-*r/4.5%
neg-mul-14.5%
distribute-lft-neg-in4.5%
*-commutative4.5%
Simplified4.5%
Taylor expanded in ky around 0 38.0%
mul-1-neg38.0%
Simplified38.0%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 7.5e-38 < ky Initial program 99.7%
Taylor expanded in kx around 0 42.9%
if -2.1999999999999999e136 < ky < -7.1999999999999995e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around -inf 25.2%
associate-*r/25.2%
neg-mul-125.2%
distribute-lft-neg-in25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in ky around 0 43.5%
neg-mul-143.5%
distribute-rgt-neg-in43.5%
Simplified43.5%
if -7.1999999999999995e-153 < ky < 7.5e-38Initial program 85.7%
Taylor expanded in ky around 0 51.2%
*-commutative51.2%
associate-/l*54.3%
Simplified54.3%
Final simplification46.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -5.4e-180)
t_1
(if (<= ky 6.6e-97) (* (sin th) (/ ky kx)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -5.4e-180) {
tmp = t_1;
} else if (ky <= 6.6e-97) {
tmp = sin(th) * (ky / 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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-5.4d-180)) then
tmp = t_1
else if (ky <= 6.6d-97) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -5.4e-180) {
tmp = t_1;
} else if (ky <= 6.6e-97) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -5.4e-180: tmp = t_1 elif ky <= 6.6e-97: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -5.4e-180) tmp = t_1; elseif (ky <= 6.6e-97) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -5.4e-180) tmp = t_1; elseif (ky <= 6.6e-97) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -5.4e-180], t$95$1, If[LessEqual[ky, 6.6e-97], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -5.4 \cdot 10^{-180}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 6.6 \cdot 10^{-97}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222 or -2.1999999999999999e136 < ky < -5.40000000000000028e-180Initial program 96.4%
+-commutative96.4%
unpow296.4%
unpow296.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.3%
Taylor expanded in ky around -inf 22.2%
associate-*r/22.2%
neg-mul-122.2%
distribute-lft-neg-in22.2%
*-commutative22.2%
Simplified22.2%
Taylor expanded in ky around 0 41.4%
mul-1-neg41.4%
Simplified41.4%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 6.6000000000000002e-97 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.4%
if -5.40000000000000028e-180 < ky < 6.6000000000000002e-97Initial program 85.3%
+-commutative85.3%
unpow285.3%
unpow285.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.8%
Taylor expanded in kx around 0 39.4%
Final simplification40.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -9e-179)
t_1
(if (<= ky 2.7e-96) (/ ky (/ kx (sin th))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -9e-179) {
tmp = t_1;
} else if (ky <= 2.7e-96) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-9d-179)) then
tmp = t_1
else if (ky <= 2.7d-96) 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 t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -9e-179) {
tmp = t_1;
} else if (ky <= 2.7e-96) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -9e-179: tmp = t_1 elif ky <= 2.7e-96: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -9e-179) tmp = t_1; elseif (ky <= 2.7e-96) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -9e-179) tmp = t_1; elseif (ky <= 2.7e-96) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -9e-179], t$95$1, If[LessEqual[ky, 2.7e-96], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -9 \cdot 10^{-179}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 2.7 \cdot 10^{-96}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222 or -2.1999999999999999e136 < ky < -8.99999999999999984e-179Initial program 96.4%
+-commutative96.4%
unpow296.4%
unpow296.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.3%
Taylor expanded in ky around -inf 22.2%
associate-*r/22.2%
neg-mul-122.2%
distribute-lft-neg-in22.2%
*-commutative22.2%
Simplified22.2%
Taylor expanded in ky around 0 41.4%
mul-1-neg41.4%
Simplified41.4%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 2.7e-96 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.4%
if -8.99999999999999984e-179 < ky < 2.7e-96Initial program 85.3%
Taylor expanded in ky around 0 51.5%
*-commutative51.5%
associate-/l*55.8%
Simplified55.8%
Taylor expanded in kx around 0 39.4%
Final simplification40.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -6.5e+222)
t_1
(if (<= ky -2.2e+136)
(sin th)
(if (<= ky -1.9e-197)
(/ (* ky t_1) ky)
(if (<= ky 7e-97) (/ ky (/ kx (sin th))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = sin(th);
} else if (ky <= -1.9e-197) {
tmp = (ky * t_1) / ky;
} else if (ky <= 7e-97) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-6.5d+222)) then
tmp = t_1
else if (ky <= (-2.2d+136)) then
tmp = sin(th)
else if (ky <= (-1.9d-197)) then
tmp = (ky * t_1) / ky
else if (ky <= 7d-97) 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 t_1 = -Math.sin(th);
double tmp;
if (ky <= -6.5e+222) {
tmp = t_1;
} else if (ky <= -2.2e+136) {
tmp = Math.sin(th);
} else if (ky <= -1.9e-197) {
tmp = (ky * t_1) / ky;
} else if (ky <= 7e-97) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -6.5e+222: tmp = t_1 elif ky <= -2.2e+136: tmp = math.sin(th) elif ky <= -1.9e-197: tmp = (ky * t_1) / ky elif ky <= 7e-97: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.9e-197) tmp = Float64(Float64(ky * t_1) / ky); elseif (ky <= 7e-97) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -6.5e+222) tmp = t_1; elseif (ky <= -2.2e+136) tmp = sin(th); elseif (ky <= -1.9e-197) tmp = (ky * t_1) / ky; elseif (ky <= 7e-97) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -6.5e+222], t$95$1, If[LessEqual[ky, -2.2e+136], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.9e-197], N[(N[(ky * t$95$1), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[ky, 7e-97], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{+136}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.9 \cdot 10^{-197}:\\
\;\;\;\;\frac{ky \cdot t_1}{ky}\\
\mathbf{elif}\;ky \leq 7 \cdot 10^{-97}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.5%
Taylor expanded in ky around -inf 4.5%
associate-*r/4.5%
neg-mul-14.5%
distribute-lft-neg-in4.5%
*-commutative4.5%
Simplified4.5%
Taylor expanded in ky around 0 38.0%
mul-1-neg38.0%
Simplified38.0%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or 7.00000000000000038e-97 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.4%
if -2.1999999999999999e136 < ky < -1.8999999999999999e-197Initial program 93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.4%
Taylor expanded in ky around -inf 29.1%
associate-*r/29.1%
neg-mul-129.1%
distribute-lft-neg-in29.1%
*-commutative29.1%
Simplified29.1%
Taylor expanded in ky around 0 44.3%
neg-mul-144.3%
distribute-rgt-neg-in44.3%
Simplified44.3%
if -1.8999999999999999e-197 < ky < 7.00000000000000038e-97Initial program 87.1%
Taylor expanded in ky around 0 53.1%
*-commutative53.1%
associate-/l*57.8%
Simplified57.8%
Taylor expanded in kx around 0 41.4%
Final simplification42.0%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -6.5e+222) (and (not (<= ky -2.2e+136)) (<= ky -2e-310))) (- (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -6.5e+222) || (!(ky <= -2.2e+136) && (ky <= -2e-310))) {
tmp = -sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-6.5d+222)) .or. (.not. (ky <= (-2.2d+136))) .and. (ky <= (-2d-310))) then
tmp = -sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -6.5e+222) || (!(ky <= -2.2e+136) && (ky <= -2e-310))) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -6.5e+222) or (not (ky <= -2.2e+136) and (ky <= -2e-310)): tmp = -math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -6.5e+222) || (!(ky <= -2.2e+136) && (ky <= -2e-310))) tmp = Float64(-sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -6.5e+222) || (~((ky <= -2.2e+136)) && (ky <= -2e-310))) tmp = -sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -6.5e+222], And[N[Not[LessEqual[ky, -2.2e+136]], $MachinePrecision], LessEqual[ky, -2e-310]]], (-N[Sin[th], $MachinePrecision]), N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6.5 \cdot 10^{+222} \lor \neg \left(ky \leq -2.2 \cdot 10^{+136}\right) \land ky \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.5000000000000006e222 or -2.1999999999999999e136 < ky < -1.999999999999994e-310Initial program 92.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 56.9%
Taylor expanded in ky around -inf 27.3%
associate-*r/27.3%
neg-mul-127.3%
distribute-lft-neg-in27.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in ky around 0 35.1%
mul-1-neg35.1%
Simplified35.1%
if -6.5000000000000006e222 < ky < -2.1999999999999999e136 or -1.999999999999994e-310 < ky Initial program 97.4%
Taylor expanded in kx around 0 35.8%
Final simplification35.4%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.8%
Taylor expanded in kx around 0 23.8%
Final simplification23.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.8%
associate-/r/94.8%
+-commutative94.8%
unpow294.8%
sqr-neg94.8%
sin-neg94.8%
sin-neg94.8%
unpow294.8%
+-commutative94.8%
Simplified99.6%
Taylor expanded in th around 0 44.0%
associate-*r/44.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def46.4%
*-rgt-identity46.4%
hypot-def44.1%
unpow244.1%
unpow244.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def46.4%
Simplified46.4%
Taylor expanded in kx around 0 10.5%
Final simplification10.5%
herbie shell --seed 2023264
(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)))