
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 95.0%
remove-double-neg95.0%
sin-neg95.0%
unpow195.0%
metadata-eval95.0%
sqr-pow48.8%
distribute-rgt-neg-in48.8%
associate-/l*48.8%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 4e-7)
(* (sin ky) (/ (sin th) (hypot (sin ky) kx)))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 4e-7) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 4e-7) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 4e-7: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 4e-7) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
if -0.149999999999999994 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 90.8%
associate-*l/84.9%
associate-*r/90.7%
+-commutative90.7%
unpow290.7%
unpow290.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 96.9%
if 3.9999999999999998e-7 < (sin.f64 kx) Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
unpow199.5%
metadata-eval99.5%
sqr-pow44.1%
distribute-rgt-neg-in44.1%
associate-/l*43.9%
Simplified99.5%
Taylor expanded in ky around 0 65.1%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 4e-7)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 4e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = (ky * -Math.sin(th)) / 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(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = (ky * -math.sin(th)) / 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(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 4e-7) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $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[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\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 th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
if -0.149999999999999994 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow47.7%
distribute-rgt-neg-in47.7%
associate-/l*47.7%
Simplified99.9%
Taylor expanded in kx around 0 97.0%
if 3.9999999999999998e-7 < (sin.f64 kx) Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
unpow199.5%
metadata-eval99.5%
sqr-pow44.1%
distribute-rgt-neg-in44.1%
associate-/l*43.9%
Simplified99.5%
Taylor expanded in ky around 0 65.1%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (sin th) (/ (hypot ky (sin kx)) (sin ky)))
(if (<= (sin kx) 4e-7)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky));
} else if (sin(kx) <= 4e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else if (Math.sin(kx) <= 4e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) elif math.sin(kx) <= 4e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / sin(ky))); elseif (sin(kx) <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky)); elseif (sin(kx) <= 4e-7) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $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[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\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 th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 53.1%
if -0.149999999999999994 < (sin.f64 kx) < 3.9999999999999998e-7Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow47.7%
distribute-rgt-neg-in47.7%
associate-/l*47.7%
Simplified99.9%
Taylor expanded in kx around 0 97.0%
if 3.9999999999999998e-7 < (sin.f64 kx) Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
unpow199.5%
metadata-eval99.5%
sqr-pow44.1%
distribute-rgt-neg-in44.1%
associate-/l*43.9%
Simplified99.5%
Taylor expanded in ky around 0 65.1%
Final simplification78.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 0.01)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 0.01) {
tmp = sin(th) * (ky / hypot(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.15) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 0.01) {
tmp = Math.sin(th) * (ky / Math.hypot(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.15: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 0.01: tmp = math.sin(th) * (ky / math.hypot(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.15) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 0.01) tmp = Float64(sin(th) * Float64(ky / hypot(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.15) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 0.01) tmp = sin(th) * (ky / hypot(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.15], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 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.15:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
if -0.149999999999999994 < (sin.f64 kx) < 0.0100000000000000002Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow48.1%
distribute-rgt-neg-in48.1%
associate-/l*48.1%
Simplified99.9%
Taylor expanded in kx around 0 96.3%
Taylor expanded in ky around 0 50.3%
Taylor expanded in ky around 0 70.1%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.4%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 66.1%
Final simplification64.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 0.01)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 0.01) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 0.01) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 0.01: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 0.01) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 0.01) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
if -0.149999999999999994 < (sin.f64 kx) < 0.0100000000000000002Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow48.1%
distribute-rgt-neg-in48.1%
associate-/l*48.1%
Simplified99.9%
Taylor expanded in kx around 0 96.3%
Taylor expanded in ky around 0 50.3%
Taylor expanded in ky around 0 70.1%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
unpow199.4%
metadata-eval99.4%
sqr-pow43.0%
distribute-rgt-neg-in43.0%
associate-/l*42.9%
Simplified99.5%
Taylor expanded in ky around 0 66.1%
Final simplification64.2%
(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 95.0%
associate-*l/91.9%
associate-*r/95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (* (sin ky) th) (hypot (sin ky) (sin kx))))
(t_2 (hypot (sin ky) kx)))
(if (<= ky -0.0014)
t_1
(if (<= ky 0.0112)
(/ (sin th) (/ (hypot ky (sin kx)) (sin ky)))
(if (<= ky 6e+64)
(* (sin ky) (/ (sin th) t_2))
(if (<= ky 6e+232) t_1 (* (sin th) (/ (sin ky) t_2))))))))
double code(double kx, double ky, double th) {
double t_1 = (sin(ky) * th) / hypot(sin(ky), sin(kx));
double t_2 = hypot(sin(ky), kx);
double tmp;
if (ky <= -0.0014) {
tmp = t_1;
} else if (ky <= 0.0112) {
tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky));
} else if (ky <= 6e+64) {
tmp = sin(ky) * (sin(th) / t_2);
} else if (ky <= 6e+232) {
tmp = t_1;
} else {
tmp = sin(th) * (sin(ky) / t_2);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.hypot(Math.sin(ky), kx);
double tmp;
if (ky <= -0.0014) {
tmp = t_1;
} else if (ky <= 0.0112) {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else if (ky <= 6e+64) {
tmp = Math.sin(ky) * (Math.sin(th) / t_2);
} else if (ky <= 6e+232) {
tmp = t_1;
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_2);
}
return tmp;
}
def code(kx, ky, th): t_1 = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.hypot(math.sin(ky), kx) tmp = 0 if ky <= -0.0014: tmp = t_1 elif ky <= 0.0112: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) elif ky <= 6e+64: tmp = math.sin(ky) * (math.sin(th) / t_2) elif ky <= 6e+232: tmp = t_1 else: tmp = math.sin(th) * (math.sin(ky) / t_2) return tmp
function code(kx, ky, th) t_1 = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))) t_2 = hypot(sin(ky), kx) tmp = 0.0 if (ky <= -0.0014) tmp = t_1; elseif (ky <= 0.0112) tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / sin(ky))); elseif (ky <= 6e+64) tmp = Float64(sin(ky) * Float64(sin(th) / t_2)); elseif (ky <= 6e+232) tmp = t_1; else tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = (sin(ky) * th) / hypot(sin(ky), sin(kx)); t_2 = hypot(sin(ky), kx); tmp = 0.0; if (ky <= -0.0014) tmp = t_1; elseif (ky <= 0.0112) tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky)); elseif (ky <= 6e+64) tmp = sin(ky) * (sin(th) / t_2); elseif (ky <= 6e+232) tmp = t_1; else tmp = sin(th) * (sin(ky) / t_2); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]}, If[LessEqual[ky, -0.0014], t$95$1, If[LessEqual[ky, 0.0112], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 6e+64], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 6e+232], t$95$1, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_2 := \mathsf{hypot}\left(\sin ky, kx\right)\\
\mathbf{if}\;ky \leq -0.0014:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 0.0112:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;ky \leq 6 \cdot 10^{+64}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t_2}\\
\mathbf{elif}\;ky \leq 6 \cdot 10^{+232}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_2}\\
\end{array}
\end{array}
if ky < -0.00139999999999999999 or 6.0000000000000004e64 < ky < 6.00000000000000006e232Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 65.1%
if -0.00139999999999999999 < ky < 0.0111999999999999999Initial program 90.4%
associate-*l/84.4%
associate-*r/90.3%
+-commutative90.3%
unpow290.3%
unpow290.3%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
if 0.0111999999999999999 < ky < 6.0000000000000004e64Initial program 100.0%
associate-*l/99.6%
associate-*r/100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Simplified100.0%
Taylor expanded in kx around 0 100.0%
if 6.00000000000000006e232 < ky Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
unpow199.8%
metadata-eval99.8%
sqr-pow54.6%
distribute-rgt-neg-in54.6%
associate-/l*54.5%
Simplified99.9%
Taylor expanded in kx around 0 57.4%
Final simplification83.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(* (sin th) (/ (- ky) (sin kx)))
(if (<= (sin kx) 0.01)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = sin(th) * (-ky / sin(kx));
} else if (sin(kx) <= 0.01) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = Math.sin(th) * (-ky / Math.sin(kx));
} else if (Math.sin(kx) <= 0.01) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = math.sin(th) * (-ky / math.sin(kx)) elif math.sin(kx) <= 0.01: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(sin(th) * Float64(Float64(-ky) / sin(kx))); elseif (sin(kx) <= 0.01) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = sin(th) * (-ky / sin(kx)); elseif (sin(kx) <= 0.01) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[Sin[th], $MachinePrecision] * N[((-ky) / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\sin th \cdot \frac{-ky}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
*-commutative51.7%
associate-/l*51.6%
mul-1-neg51.6%
associate-/l*51.7%
associate-*r/51.7%
Simplified51.7%
if -0.149999999999999994 < (sin.f64 kx) < 0.0100000000000000002Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow48.1%
distribute-rgt-neg-in48.1%
associate-/l*48.1%
Simplified99.9%
Taylor expanded in kx around 0 96.3%
Taylor expanded in ky around 0 50.3%
Taylor expanded in ky around 0 70.1%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.4%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 57.9%
associate-/l*57.8%
associate-/r/58.0%
Simplified58.0%
Final simplification62.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (- (sin th)) (/ (sin kx) ky))
(if (<= (sin kx) 0.01)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = -sin(th) / (sin(kx) / ky);
} else if (sin(kx) <= 0.01) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = -Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(kx) <= 0.01) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = -math.sin(th) / (math.sin(kx) / ky) elif math.sin(kx) <= 0.01: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(Float64(-sin(th)) / Float64(sin(kx) / ky)); elseif (sin(kx) <= 0.01) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = -sin(th) / (sin(kx) / ky); elseif (sin(kx) <= 0.01) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[((-N[Sin[th], $MachinePrecision]) / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{-\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
*-commutative51.7%
associate-/l*51.6%
associate-*r/51.6%
neg-mul-151.6%
Simplified51.6%
if -0.149999999999999994 < (sin.f64 kx) < 0.0100000000000000002Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow48.1%
distribute-rgt-neg-in48.1%
associate-/l*48.1%
Simplified99.9%
Taylor expanded in kx around 0 96.3%
Taylor expanded in ky around 0 50.3%
Taylor expanded in ky around 0 70.1%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.4%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 57.9%
associate-/l*57.8%
associate-/r/58.0%
Simplified58.0%
Final simplification62.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.15)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 0.01)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.15) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 0.01) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.15) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 0.01) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.15: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 0.01: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.15) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 0.01) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.15) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 0.01) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.15], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.15:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.149999999999999994Initial program 99.5%
associate-*l/99.3%
associate-*r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
*-commutative99.5%
associate-/r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt9.5%
sqrt-unprod16.8%
pow216.8%
associate-/r/16.8%
*-commutative16.8%
Applied egg-rr16.8%
Taylor expanded in ky around -inf 51.7%
if -0.149999999999999994 < (sin.f64 kx) < 0.0100000000000000002Initial program 90.8%
remove-double-neg90.8%
sin-neg90.8%
unpow190.8%
metadata-eval90.8%
sqr-pow48.1%
distribute-rgt-neg-in48.1%
associate-/l*48.1%
Simplified99.9%
Taylor expanded in kx around 0 96.3%
Taylor expanded in ky around 0 50.3%
Taylor expanded in ky around 0 70.1%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.4%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 57.9%
associate-/l*57.8%
associate-/r/58.0%
Simplified58.0%
Final simplification62.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-113) (* th (/ ky (sin kx))) (if (<= (sin ky) 1e-126) (* (sin th) (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-113) {
tmp = th * (ky / sin(kx));
} else if (sin(ky) <= 1e-126) {
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) :: tmp
if (sin(ky) <= (-2d-113)) then
tmp = th * (ky / sin(kx))
else if (sin(ky) <= 1d-126) 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 tmp;
if (Math.sin(ky) <= -2e-113) {
tmp = th * (ky / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-126) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-113: tmp = th * (ky / math.sin(kx)) elif math.sin(ky) <= 1e-126: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-113) tmp = Float64(th * Float64(ky / sin(kx))); elseif (sin(ky) <= 1e-126) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-113) tmp = th * (ky / sin(kx)); elseif (sin(ky) <= 1e-126) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-113], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-126], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-113}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-126}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999996e-113Initial program 99.7%
associate-*l/98.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 10.9%
add-sqr-sqrt4.6%
sqrt-unprod8.0%
pow28.0%
associate-/r/8.0%
*-commutative8.0%
Applied egg-rr8.0%
Taylor expanded in th around 0 7.1%
associate-/l*7.1%
associate-/r/7.1%
Simplified7.1%
if -1.99999999999999996e-113 < (sin.f64 ky) < 9.9999999999999995e-127Initial program 83.5%
remove-double-neg83.5%
sin-neg83.5%
unpow183.5%
metadata-eval83.5%
sqr-pow41.6%
distribute-rgt-neg-in41.6%
associate-/l*41.6%
Simplified99.7%
Taylor expanded in kx around 0 61.5%
Taylor expanded in ky around 0 31.9%
associate-/l*36.5%
associate-/r/36.5%
Simplified36.5%
if 9.9999999999999995e-127 < (sin.f64 ky) Initial program 99.7%
associate-*l/97.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 56.4%
Final simplification32.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-115) (/ ky (/ (sin kx) th)) (if (<= (sin ky) 1e-126) (* (sin th) (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-115) {
tmp = ky / (sin(kx) / th);
} else if (sin(ky) <= 1e-126) {
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) :: tmp
if (sin(ky) <= (-2d-115)) then
tmp = ky / (sin(kx) / th)
else if (sin(ky) <= 1d-126) 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 tmp;
if (Math.sin(ky) <= -2e-115) {
tmp = ky / (Math.sin(kx) / th);
} else if (Math.sin(ky) <= 1e-126) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-115: tmp = ky / (math.sin(kx) / th) elif math.sin(ky) <= 1e-126: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-115) tmp = Float64(ky / Float64(sin(kx) / th)); elseif (sin(ky) <= 1e-126) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-115) tmp = ky / (sin(kx) / th); elseif (sin(ky) <= 1e-126) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-115], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-126], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-126}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.0000000000000001e-115Initial program 99.7%
associate-*l/98.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 11.9%
Taylor expanded in th around 0 8.1%
associate-/l*8.1%
Simplified8.1%
if -2.0000000000000001e-115 < (sin.f64 ky) < 9.9999999999999995e-127Initial program 83.3%
remove-double-neg83.3%
sin-neg83.3%
unpow183.3%
metadata-eval83.3%
sqr-pow40.8%
distribute-rgt-neg-in40.8%
associate-/l*40.8%
Simplified99.7%
Taylor expanded in kx around 0 61.0%
Taylor expanded in ky around 0 31.0%
associate-/l*35.6%
associate-/r/35.7%
Simplified35.7%
if 9.9999999999999995e-127 < (sin.f64 ky) Initial program 99.7%
associate-*l/97.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 56.4%
Final simplification32.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-117) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-117) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-117) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-117) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-117: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-117) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-117) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-117], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-117}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000006e-117Initial program 92.8%
associate-*l/88.8%
associate-*r/92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 28.2%
associate-/l*30.2%
associate-/r/30.2%
Simplified30.2%
if 2.00000000000000006e-117 < (sin.f64 ky) Initial program 99.7%
associate-*l/98.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.5%
Final simplification38.7%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -0.95) (not (<= ky 1.1e-123))) (sin th) (* (sin th) (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.95) || !(ky <= 1.1e-123)) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-0.95d0)) .or. (.not. (ky <= 1.1d-123))) then
tmp = sin(th)
else
tmp = sin(th) * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.95) || !(ky <= 1.1e-123)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -0.95) or not (ky <= 1.1e-123): tmp = math.sin(th) else: tmp = math.sin(th) * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -0.95) || !(ky <= 1.1e-123)) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -0.95) || ~((ky <= 1.1e-123))) tmp = sin(th); else tmp = sin(th) * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -0.95], N[Not[LessEqual[ky, 1.1e-123]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.95 \lor \neg \left(ky \leq 1.1 \cdot 10^{-123}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -0.94999999999999996 or 1.10000000000000003e-123 < ky Initial program 99.7%
associate-*l/98.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 32.8%
if -0.94999999999999996 < ky < 1.10000000000000003e-123Initial program 87.8%
remove-double-neg87.8%
sin-neg87.8%
unpow187.8%
metadata-eval87.8%
sqr-pow57.0%
distribute-rgt-neg-in57.0%
associate-/l*57.0%
Simplified99.7%
Taylor expanded in kx around 0 56.9%
Taylor expanded in ky around 0 25.6%
associate-/l*28.9%
associate-/r/28.9%
Simplified28.9%
Final simplification31.2%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -0.95) (not (<= ky 1.35e-126))) (sin th) (/ ky (/ kx th))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.95) || !(ky <= 1.35e-126)) {
tmp = sin(th);
} else {
tmp = ky / (kx / th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-0.95d0)) .or. (.not. (ky <= 1.35d-126))) then
tmp = sin(th)
else
tmp = ky / (kx / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.95) || !(ky <= 1.35e-126)) {
tmp = Math.sin(th);
} else {
tmp = ky / (kx / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -0.95) or not (ky <= 1.35e-126): tmp = math.sin(th) else: tmp = ky / (kx / th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -0.95) || !(ky <= 1.35e-126)) tmp = sin(th); else tmp = Float64(ky / Float64(kx / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -0.95) || ~((ky <= 1.35e-126))) tmp = sin(th); else tmp = ky / (kx / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -0.95], N[Not[LessEqual[ky, 1.35e-126]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.95 \lor \neg \left(ky \leq 1.35 \cdot 10^{-126}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\end{array}
\end{array}
if ky < -0.94999999999999996 or 1.34999999999999998e-126 < ky Initial program 99.7%
associate-*l/98.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 32.8%
if -0.94999999999999996 < ky < 1.34999999999999998e-126Initial program 87.8%
remove-double-neg87.8%
sin-neg87.8%
unpow187.8%
metadata-eval87.8%
sqr-pow57.0%
distribute-rgt-neg-in57.0%
associate-/l*57.0%
Simplified99.7%
Taylor expanded in kx around 0 56.9%
Taylor expanded in ky around 0 25.6%
associate-/l*28.9%
associate-/r/28.9%
Simplified28.9%
Taylor expanded in th around 0 17.4%
associate-/l*20.7%
Simplified20.7%
Final simplification28.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.02e+40) th (if (<= ky 2.8e-117) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.02e+40) {
tmp = th;
} else if (ky <= 2.8e-117) {
tmp = th * (ky / kx);
} 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.02d+40)) then
tmp = th
else if (ky <= 2.8d-117) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.02e+40) {
tmp = th;
} else if (ky <= 2.8e-117) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.02e+40: tmp = th elif ky <= 2.8e-117: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.02e+40) tmp = th; elseif (ky <= 2.8e-117) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.02e+40) tmp = th; elseif (ky <= 2.8e-117) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.02e+40], th, If[LessEqual[ky, 2.8e-117], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.02 \cdot 10^{+40}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 2.8 \cdot 10^{-117}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.02e40 or 2.8e-117 < ky Initial program 99.7%
associate-*l/98.9%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 33.4%
Taylor expanded in th around 0 22.2%
if -1.02e40 < ky < 2.8e-117Initial program 89.0%
remove-double-neg89.0%
sin-neg89.0%
unpow189.0%
metadata-eval89.0%
sqr-pow56.7%
distribute-rgt-neg-in56.7%
associate-/l*56.7%
Simplified99.7%
Taylor expanded in kx around 0 57.7%
Taylor expanded in ky around 0 23.4%
associate-/l*26.5%
associate-/r/26.5%
Simplified26.5%
Taylor expanded in th around 0 16.1%
associate-/l*19.1%
Simplified19.1%
associate-/r/19.1%
Applied egg-rr19.1%
Final simplification20.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.02e+40) th (if (<= ky 3.1e-117) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.02e+40) {
tmp = th;
} else if (ky <= 3.1e-117) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.02d+40)) then
tmp = th
else if (ky <= 3.1d-117) then
tmp = ky / (kx / th)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.02e+40) {
tmp = th;
} else if (ky <= 3.1e-117) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.02e+40: tmp = th elif ky <= 3.1e-117: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.02e+40) tmp = th; elseif (ky <= 3.1e-117) tmp = Float64(ky / Float64(kx / th)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.02e+40) tmp = th; elseif (ky <= 3.1e-117) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.02e+40], th, If[LessEqual[ky, 3.1e-117], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.02 \cdot 10^{+40}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.1 \cdot 10^{-117}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.02e40 or 3.10000000000000011e-117 < ky Initial program 99.7%
associate-*l/98.9%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 33.4%
Taylor expanded in th around 0 22.2%
if -1.02e40 < ky < 3.10000000000000011e-117Initial program 89.0%
remove-double-neg89.0%
sin-neg89.0%
unpow189.0%
metadata-eval89.0%
sqr-pow56.7%
distribute-rgt-neg-in56.7%
associate-/l*56.7%
Simplified99.7%
Taylor expanded in kx around 0 57.7%
Taylor expanded in ky around 0 23.4%
associate-/l*26.5%
associate-/r/26.5%
Simplified26.5%
Taylor expanded in th around 0 16.1%
associate-/l*19.1%
Simplified19.1%
Final simplification20.9%
(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 95.0%
associate-*l/91.9%
associate-*r/95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 22.1%
Taylor expanded in th around 0 14.8%
Final simplification14.8%
herbie shell --seed 2023301
(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)))