
(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 17 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%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= (sin th) -0.02) (not (<= (sin th) 0.08)))
(/ (* ky (sin th)) t_1)
(* (sin ky) (/ th t_1)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((sin(th) <= -0.02) || !(sin(th) <= 0.08)) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = sin(ky) * (th / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if ((Math.sin(th) <= -0.02) || !(Math.sin(th) <= 0.08)) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = Math.sin(ky) * (th / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (math.sin(th) <= -0.02) or not (math.sin(th) <= 0.08): tmp = (ky * math.sin(th)) / t_1 else: tmp = math.sin(ky) * (th / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((sin(th) <= -0.02) || !(sin(th) <= 0.08)) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = Float64(sin(ky) * Float64(th / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((sin(th) <= -0.02) || ~((sin(th) <= 0.08))) tmp = (ky * sin(th)) / t_1; else tmp = sin(ky) * (th / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[Or[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Not[LessEqual[N[Sin[th], $MachinePrecision], 0.08]], $MachinePrecision]], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin th \leq -0.02 \lor \neg \left(\sin th \leq 0.08\right):\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004 or 0.0800000000000000017 < (sin.f64 th) Initial program 94.7%
associate-*l/94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.2%
if -0.0200000000000000004 < (sin.f64 th) < 0.0800000000000000017Initial program 95.3%
associate-/r/95.2%
+-commutative95.2%
unpow295.2%
unpow295.2%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 93.6%
associate-*r/93.7%
unpow293.7%
unpow293.7%
hypot-def98.1%
*-rgt-identity98.1%
hypot-def93.7%
unpow293.7%
unpow293.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-def98.1%
Simplified98.1%
clear-num97.9%
associate-/r/98.0%
clear-num98.2%
hypot-udef93.8%
+-commutative93.8%
hypot-udef98.2%
Applied egg-rr98.2%
Final simplification75.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.02)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 2e-8)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (sin ky) (fabs (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.02) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 2e-8) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.02) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 2e-8) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.02: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 2e-8: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.02) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 2e-8) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.02) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 2e-8) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-8], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.02:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004Initial program 94.2%
associate-*l/94.0%
associate-*r/94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 20.1%
if -0.0200000000000000004 < (sin.f64 th) < 2e-8Initial program 95.2%
associate-/r/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 95.0%
associate-*r/95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
*-rgt-identity99.5%
hypot-def95.1%
unpow295.1%
unpow295.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.5%
clear-num99.7%
hypot-udef95.2%
+-commutative95.2%
hypot-udef99.7%
Applied egg-rr99.7%
if 2e-8 < (sin.f64 th) Initial program 95.5%
associate-/r/95.4%
+-commutative95.4%
unpow295.4%
unpow295.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 23.7%
add-sqr-sqrt22.6%
sqrt-unprod47.4%
pow247.4%
Applied egg-rr47.4%
unpow247.4%
rem-sqrt-square47.9%
Simplified47.9%
Final simplification64.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (sin kx))))
(if (<= (sin ky) -5e-287)
(* (sin th) t_1)
(if (<= (sin ky) 1e-46) (* (sin th) (fabs t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = ky / sin(kx);
double tmp;
if (sin(ky) <= -5e-287) {
tmp = sin(th) * t_1;
} else if (sin(ky) <= 1e-46) {
tmp = sin(th) * fabs(t_1);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = ky / sin(kx)
if (sin(ky) <= (-5d-287)) then
tmp = sin(th) * t_1
else if (sin(ky) <= 1d-46) then
tmp = sin(th) * abs(t_1)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / Math.sin(kx);
double tmp;
if (Math.sin(ky) <= -5e-287) {
tmp = Math.sin(th) * t_1;
} else if (Math.sin(ky) <= 1e-46) {
tmp = Math.sin(th) * Math.abs(t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / math.sin(kx) tmp = 0 if math.sin(ky) <= -5e-287: tmp = math.sin(th) * t_1 elif math.sin(ky) <= 1e-46: tmp = math.sin(th) * math.fabs(t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky / sin(kx)) tmp = 0.0 if (sin(ky) <= -5e-287) tmp = Float64(sin(th) * t_1); elseif (sin(ky) <= 1e-46) tmp = Float64(sin(th) * abs(t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / sin(kx); tmp = 0.0; if (sin(ky) <= -5e-287) tmp = sin(th) * t_1; elseif (sin(ky) <= 1e-46) tmp = sin(th) * abs(t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-287], N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-46], N[(N[Sin[th], $MachinePrecision] * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-287}:\\
\;\;\;\;\sin th \cdot t_1\\
\mathbf{elif}\;\sin ky \leq 10^{-46}:\\
\;\;\;\;\sin th \cdot \left|t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000025e-287Initial program 96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 26.8%
if -5.00000000000000025e-287 < (sin.f64 ky) < 1.00000000000000002e-46Initial program 81.4%
+-commutative81.4%
unpow281.4%
unpow281.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 39.3%
add-sqr-sqrt32.4%
sqrt-unprod67.0%
pow267.0%
Applied egg-rr67.0%
unpow267.0%
rem-sqrt-square82.9%
Simplified82.9%
Taylor expanded in ky around 0 82.9%
if 1.00000000000000002e-46 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification47.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-287) (* (sin ky) (/ (sin th) (sin kx))) (if (<= (sin ky) 1e-46) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-287) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-46) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-287)) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-46) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-287) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-46) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-287: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-46: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-287) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-46) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-287) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-46) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-287], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-46], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / 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^{-287}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-46}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000025e-287Initial program 96.8%
associate-*l/94.6%
associate-*r/96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 29.3%
if -5.00000000000000025e-287 < (sin.f64 ky) < 1.00000000000000002e-46Initial program 81.4%
+-commutative81.4%
unpow281.4%
unpow281.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 39.3%
add-sqr-sqrt32.4%
sqrt-unprod67.0%
pow267.0%
Applied egg-rr67.0%
unpow267.0%
rem-sqrt-square82.9%
Simplified82.9%
Taylor expanded in ky around 0 82.9%
if 1.00000000000000002e-46 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification48.8%
(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/92.7%
associate-*r/94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (* ky (sin th))))
(if (<= th -2300000.0)
(* (/ 1.0 t_1) t_2)
(if (<= th 1.28e-8) (* (sin ky) (/ th t_1)) (/ t_2 t_1)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = ky * sin(th);
double tmp;
if (th <= -2300000.0) {
tmp = (1.0 / t_1) * t_2;
} else if (th <= 1.28e-8) {
tmp = sin(ky) * (th / t_1);
} else {
tmp = t_2 / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = ky * Math.sin(th);
double tmp;
if (th <= -2300000.0) {
tmp = (1.0 / t_1) * t_2;
} else if (th <= 1.28e-8) {
tmp = Math.sin(ky) * (th / t_1);
} else {
tmp = t_2 / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = ky * math.sin(th) tmp = 0 if th <= -2300000.0: tmp = (1.0 / t_1) * t_2 elif th <= 1.28e-8: tmp = math.sin(ky) * (th / t_1) else: tmp = t_2 / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(ky * sin(th)) tmp = 0.0 if (th <= -2300000.0) tmp = Float64(Float64(1.0 / t_1) * t_2); elseif (th <= 1.28e-8) tmp = Float64(sin(ky) * Float64(th / t_1)); else tmp = Float64(t_2 / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = ky * sin(th); tmp = 0.0; if (th <= -2300000.0) tmp = (1.0 / t_1) * t_2; elseif (th <= 1.28e-8) tmp = sin(ky) * (th / t_1); else tmp = t_2 / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[th, -2300000.0], N[(N[(1.0 / t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[th, 1.28e-8], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$2 / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := ky \cdot \sin th\\
\mathbf{if}\;th \leq -2300000:\\
\;\;\;\;\frac{1}{t_1} \cdot t_2\\
\mathbf{elif}\;th \leq 1.28 \cdot 10^{-8}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{t_1}\\
\end{array}
\end{array}
if th < -2.3e6Initial program 94.4%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.5%
Simplified99.5%
*-un-lft-identity99.5%
div-inv99.3%
times-frac99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 57.3%
if -2.3e6 < th < 1.28000000000000005e-8Initial program 95.2%
associate-/r/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 94.2%
associate-*r/94.3%
unpow294.3%
unpow294.3%
hypot-def98.8%
*-rgt-identity98.8%
hypot-def94.3%
unpow294.3%
unpow294.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def98.8%
Simplified98.8%
clear-num98.6%
associate-/r/98.7%
clear-num99.0%
hypot-udef94.5%
+-commutative94.5%
hypot-udef99.0%
Applied egg-rr99.0%
if 1.28000000000000005e-8 < th Initial program 95.1%
associate-*l/95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.1%
Final simplification75.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-46) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-46) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-46) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-46) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-46: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-46) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-46) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-46], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-46}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000002e-46Initial program 92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 30.1%
if 1.00000000000000002e-46 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification39.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-49) (* (* ky (sin th)) (+ (* kx 0.16666666666666666) (/ 1.0 kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-49) {
tmp = (ky * sin(th)) * ((kx * 0.16666666666666666) + (1.0 / kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-49) then
tmp = (ky * sin(th)) * ((kx * 0.16666666666666666d0) + (1.0d0 / kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-49) {
tmp = (ky * Math.sin(th)) * ((kx * 0.16666666666666666) + (1.0 / kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-49: tmp = (ky * math.sin(th)) * ((kx * 0.16666666666666666) + (1.0 / kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-49) tmp = Float64(Float64(ky * sin(th)) * Float64(Float64(kx * 0.16666666666666666) + Float64(1.0 / kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-49) tmp = (ky * sin(th)) * ((kx * 0.16666666666666666) + (1.0 / kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-49], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[(N[(kx * 0.16666666666666666), $MachinePrecision] + N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-49}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \left(kx \cdot 0.16666666666666666 + \frac{1}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999936e-50Initial program 92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 31.6%
Taylor expanded in kx around 0 14.4%
Taylor expanded in ky around 0 16.7%
if 9.99999999999999936e-50 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.1%
Final simplification30.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-278) (/ ky (* (sin kx) (/ 1.0 th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-278) {
tmp = ky / (sin(kx) * (1.0 / th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 4d-278) then
tmp = ky / (sin(kx) * (1.0d0 / th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 4e-278) {
tmp = ky / (Math.sin(kx) * (1.0 / th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 4e-278: tmp = ky / (math.sin(kx) * (1.0 / th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4e-278) tmp = Float64(ky / Float64(sin(kx) * Float64(1.0 / th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 4e-278) tmp = ky / (sin(kx) * (1.0 / th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-278], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-278}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \frac{1}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 3.99999999999999975e-278Initial program 95.3%
associate-/r/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 49.1%
associate-*r/49.1%
unpow249.1%
unpow249.1%
hypot-def51.5%
*-rgt-identity51.5%
hypot-def49.1%
unpow249.1%
unpow249.1%
+-commutative49.1%
unpow249.1%
unpow249.1%
hypot-def51.5%
Simplified51.5%
Taylor expanded in ky around 0 15.9%
associate-/l*17.8%
Simplified17.8%
div-inv17.8%
Applied egg-rr17.8%
if 3.99999999999999975e-278 < (sin.f64 ky) Initial program 94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 50.3%
Final simplification32.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-278) (/ ky (/ (sin kx) th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-278) {
tmp = ky / (sin(kx) / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 4d-278) then
tmp = ky / (sin(kx) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 4e-278) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 4e-278: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4e-278) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 4e-278) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-278], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-278}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 3.99999999999999975e-278Initial program 95.3%
associate-/r/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 49.1%
associate-*r/49.1%
unpow249.1%
unpow249.1%
hypot-def51.5%
*-rgt-identity51.5%
hypot-def49.1%
unpow249.1%
unpow249.1%
+-commutative49.1%
unpow249.1%
unpow249.1%
hypot-def51.5%
Simplified51.5%
Taylor expanded in ky around 0 15.9%
associate-/l*17.8%
Simplified17.8%
if 3.99999999999999975e-278 < (sin.f64 ky) Initial program 94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 50.3%
Final simplification32.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1150000000.0) (sin th) (if (<= ky 3.2e-254) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1150000000.0) {
tmp = sin(th);
} else if (ky <= 3.2e-254) {
tmp = 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 (ky <= (-1150000000.0d0)) then
tmp = sin(th)
else if (ky <= 3.2d-254) then
tmp = 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 (ky <= -1150000000.0) {
tmp = Math.sin(th);
} else if (ky <= 3.2e-254) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1150000000.0: tmp = math.sin(th) elif ky <= 3.2e-254: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1150000000.0) tmp = sin(th); elseif (ky <= 3.2e-254) tmp = Float64(th * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1150000000.0) tmp = sin(th); elseif (ky <= 3.2e-254) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1150000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.2e-254], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1150000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.2 \cdot 10^{-254}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.15e9 or 3.2e-254 < ky Initial program 96.3%
+-commutative96.3%
unpow296.3%
unpow296.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 34.4%
if -1.15e9 < ky < 3.2e-254Initial program 91.9%
associate-/r/91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 42.5%
associate-*r/42.5%
unpow242.5%
unpow242.5%
hypot-def46.7%
*-rgt-identity46.7%
hypot-def42.5%
unpow242.5%
unpow242.5%
+-commutative42.5%
unpow242.5%
unpow242.5%
hypot-def46.7%
Simplified46.7%
Taylor expanded in ky around 0 25.7%
associate-/l*29.1%
Simplified29.1%
associate-/r/29.2%
Applied egg-rr29.2%
Final simplification32.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1150000000.0) (sin th) (if (<= ky 3.2e-254) (/ th (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1150000000.0) {
tmp = sin(th);
} else if (ky <= 3.2e-254) {
tmp = th / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1150000000.0d0)) then
tmp = sin(th)
else if (ky <= 3.2d-254) then
tmp = th / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1150000000.0) {
tmp = Math.sin(th);
} else if (ky <= 3.2e-254) {
tmp = th / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1150000000.0: tmp = math.sin(th) elif ky <= 3.2e-254: tmp = th / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1150000000.0) tmp = sin(th); elseif (ky <= 3.2e-254) tmp = Float64(th / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1150000000.0) tmp = sin(th); elseif (ky <= 3.2e-254) tmp = th / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1150000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.2e-254], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1150000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.2 \cdot 10^{-254}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.15e9 or 3.2e-254 < ky Initial program 96.3%
+-commutative96.3%
unpow296.3%
unpow296.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 34.4%
if -1.15e9 < ky < 3.2e-254Initial program 91.9%
associate-/r/91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 42.5%
associate-*r/42.5%
unpow242.5%
unpow242.5%
hypot-def46.7%
*-rgt-identity46.7%
hypot-def42.5%
unpow242.5%
unpow242.5%
+-commutative42.5%
unpow242.5%
unpow242.5%
hypot-def46.7%
Simplified46.7%
Taylor expanded in ky around 0 25.7%
associate-/l*29.1%
Simplified29.1%
Taylor expanded in kx around 0 22.0%
associate-/l*25.7%
Simplified25.7%
Final simplification31.8%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -4.8e+19) (not (<= ky 1.2e-153))) (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))) (/ th (/ kx ky))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -4.8e+19) || !(ky <= 1.2e-153)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = th / (kx / ky);
}
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 <= (-4.8d+19)) .or. (.not. (ky <= 1.2d-153))) then
tmp = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
else
tmp = th / (kx / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -4.8e+19) || !(ky <= 1.2e-153)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = th / (kx / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -4.8e+19) or not (ky <= 1.2e-153): tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)) else: tmp = th / (kx / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -4.8e+19) || !(ky <= 1.2e-153)) tmp = Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); else tmp = Float64(th / Float64(kx / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -4.8e+19) || ~((ky <= 1.2e-153))) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); else tmp = th / (kx / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -4.8e+19], N[Not[LessEqual[ky, 1.2e-153]], $MachinePrecision]], N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -4.8 \cdot 10^{+19} \lor \neg \left(ky \leq 1.2 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\end{array}
\end{array}
if ky < -4.8e19 or 1.2000000000000001e-153 < ky Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in kx around 0 17.1%
if -4.8e19 < ky < 1.2000000000000001e-153Initial program 87.1%
associate-/r/86.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 40.9%
associate-*r/40.9%
unpow240.9%
unpow240.9%
hypot-def46.8%
*-rgt-identity46.8%
hypot-def40.9%
unpow240.9%
unpow240.9%
+-commutative40.9%
unpow240.9%
unpow240.9%
hypot-def46.8%
Simplified46.8%
Taylor expanded in ky around 0 24.4%
associate-/l*28.1%
Simplified28.1%
Taylor expanded in kx around 0 21.6%
associate-/l*25.5%
Simplified25.5%
Final simplification20.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky -2.4e+28) th (if (<= ky 3.7e-153) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.4e+28) {
tmp = th;
} else if (ky <= 3.7e-153) {
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 <= (-2.4d+28)) then
tmp = th
else if (ky <= 3.7d-153) 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 <= -2.4e+28) {
tmp = th;
} else if (ky <= 3.7e-153) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2.4e+28: tmp = th elif ky <= 3.7e-153: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2.4e+28) tmp = th; elseif (ky <= 3.7e-153) 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 <= -2.4e+28) tmp = th; elseif (ky <= 3.7e-153) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2.4e+28], th, If[LessEqual[ky, 3.7e-153], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2.4 \cdot 10^{+28}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.7 \cdot 10^{-153}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -2.39999999999999981e28 or 3.7000000000000003e-153 < ky Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 51.4%
associate-*r/51.5%
unpow251.5%
unpow251.5%
hypot-def51.5%
*-rgt-identity51.5%
hypot-def51.5%
unpow251.5%
unpow251.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-def51.5%
Simplified51.5%
Taylor expanded in kx around 0 16.9%
if -2.39999999999999981e28 < ky < 3.7000000000000003e-153Initial program 87.4%
associate-/r/87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 40.1%
associate-*r/40.1%
unpow240.1%
unpow240.1%
hypot-def45.9%
*-rgt-identity45.9%
hypot-def40.1%
unpow240.1%
unpow240.1%
+-commutative40.1%
unpow240.1%
unpow240.1%
hypot-def45.9%
Simplified45.9%
Taylor expanded in ky around 0 23.9%
associate-/l*27.5%
Simplified27.5%
Taylor expanded in kx around 0 24.7%
associate-/r/24.9%
Applied egg-rr24.9%
Final simplification19.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.8e+29) th (if (<= ky 2.5e-153) (/ th (/ kx ky)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.8e+29) {
tmp = th;
} else if (ky <= 2.5e-153) {
tmp = th / (kx / ky);
} 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 <= (-5.8d+29)) then
tmp = th
else if (ky <= 2.5d-153) then
tmp = th / (kx / ky)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.8e+29) {
tmp = th;
} else if (ky <= 2.5e-153) {
tmp = th / (kx / ky);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.8e+29: tmp = th elif ky <= 2.5e-153: tmp = th / (kx / ky) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.8e+29) tmp = th; elseif (ky <= 2.5e-153) tmp = Float64(th / Float64(kx / ky)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.8e+29) tmp = th; elseif (ky <= 2.5e-153) tmp = th / (kx / ky); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.8e+29], th, If[LessEqual[ky, 2.5e-153], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.8 \cdot 10^{+29}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 2.5 \cdot 10^{-153}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -5.7999999999999999e29 or 2.50000000000000016e-153 < ky Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 51.4%
associate-*r/51.5%
unpow251.5%
unpow251.5%
hypot-def51.5%
*-rgt-identity51.5%
hypot-def51.5%
unpow251.5%
unpow251.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-def51.5%
Simplified51.5%
Taylor expanded in kx around 0 16.9%
if -5.7999999999999999e29 < ky < 2.50000000000000016e-153Initial program 87.4%
associate-/r/87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 40.1%
associate-*r/40.1%
unpow240.1%
unpow240.1%
hypot-def45.9%
*-rgt-identity45.9%
hypot-def40.1%
unpow240.1%
unpow240.1%
+-commutative40.1%
unpow240.1%
unpow240.1%
hypot-def45.9%
Simplified45.9%
Taylor expanded in ky around 0 23.9%
associate-/l*27.5%
Simplified27.5%
Taylor expanded in kx around 0 21.1%
associate-/l*25.0%
Simplified25.0%
Final simplification20.0%
(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-/r/94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 47.0%
associate-*r/47.1%
unpow247.1%
unpow247.1%
hypot-def49.3%
*-rgt-identity49.3%
hypot-def47.1%
unpow247.1%
unpow247.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-def49.3%
Simplified49.3%
Taylor expanded in kx around 0 12.6%
Final simplification12.6%
herbie shell --seed 2023278
(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)))