
(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 92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.54)
(fabs (sin th))
(if (<= (sin th) -0.005)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 2e-16)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin ky) (fabs (/ (sin th) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.54) {
tmp = fabs(sin(th));
} else if (sin(th) <= -0.005) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 2e-16) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.54) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= -0.005) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 2e-16) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.54: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= -0.005: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 2e-16: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 2e-16) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.54) tmp = abs(sin(th)); elseif (sin(th) <= -0.005) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 2e-16) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) * abs((sin(th) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.54], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-16], 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[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.54:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq -0.005:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.54000000000000004Initial program 88.5%
associate-*l/88.3%
associate-*r/88.4%
+-commutative88.4%
unpow288.4%
unpow288.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 24.2%
add-sqr-sqrt0.0%
sqrt-unprod36.0%
pow236.0%
Applied egg-rr36.0%
*-commutative36.0%
associate-/r/36.1%
*-inverses36.1%
/-rgt-identity36.1%
unpow236.1%
rem-sqrt-square36.1%
Simplified36.1%
if -0.54000000000000004 < (sin.f64 th) < -0.0050000000000000001Initial program 91.7%
associate-*l/91.5%
associate-*r/91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 23.3%
if -0.0050000000000000001 < (sin.f64 th) < 2e-16Initial program 95.4%
associate-/r/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 95.1%
associate-*r/95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
*-rgt-identity99.7%
hypot-def95.3%
unpow295.3%
unpow295.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
clear-num98.8%
associate-/r/99.6%
clear-num99.8%
hypot-udef95.4%
+-commutative95.4%
hypot-udef99.8%
Applied egg-rr99.8%
if 2e-16 < (sin.f64 th) Initial program 88.5%
associate-*l/88.4%
associate-*r/88.5%
+-commutative88.5%
unpow288.5%
unpow288.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
add-sqr-sqrt26.5%
sqrt-unprod46.8%
pow246.8%
Applied egg-rr46.8%
unpow246.8%
rem-sqrt-square49.4%
Simplified49.4%
Final simplification69.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (/ (* ky (sin th)) t_1)))
(if (<= (sin th) -0.005)
t_2
(if (<= (sin th) 2e-16)
(* (sin ky) (/ th t_1))
(if (<= (sin th) 0.6) (* (sin ky) (fabs (/ (sin th) (sin ky)))) t_2)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = (ky * sin(th)) / t_1;
double tmp;
if (sin(th) <= -0.005) {
tmp = t_2;
} else if (sin(th) <= 2e-16) {
tmp = sin(ky) * (th / t_1);
} else if (sin(th) <= 0.6) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = (ky * Math.sin(th)) / t_1;
double tmp;
if (Math.sin(th) <= -0.005) {
tmp = t_2;
} else if (Math.sin(th) <= 2e-16) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(th) <= 0.6) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else {
tmp = t_2;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = (ky * math.sin(th)) / t_1 tmp = 0 if math.sin(th) <= -0.005: tmp = t_2 elif math.sin(th) <= 2e-16: tmp = math.sin(ky) * (th / t_1) elif math.sin(th) <= 0.6: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) else: tmp = t_2 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(Float64(ky * sin(th)) / t_1) tmp = 0.0 if (sin(th) <= -0.005) tmp = t_2; elseif (sin(th) <= 2e-16) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(th) <= 0.6) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); else tmp = t_2; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = (ky * sin(th)) / t_1; tmp = 0.0; if (sin(th) <= -0.005) tmp = t_2; elseif (sin(th) <= 2e-16) tmp = sin(ky) * (th / t_1); elseif (sin(th) <= 0.6) tmp = sin(ky) * abs((sin(th) / sin(ky))); else tmp = t_2; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], t$95$2, If[LessEqual[N[Sin[th], $MachinePrecision], 2e-16], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.6], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \frac{ky \cdot \sin th}{t_1}\\
\mathbf{if}\;\sin th \leq -0.005:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin th \leq 0.6:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0050000000000000001 or 0.599999999999999978 < (sin.f64 th) Initial program 87.5%
associate-*l/87.4%
+-commutative87.4%
unpow287.4%
unpow287.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 51.6%
if -0.0050000000000000001 < (sin.f64 th) < 2e-16Initial program 95.4%
associate-/r/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 95.1%
associate-*r/95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
*-rgt-identity99.7%
hypot-def95.3%
unpow295.3%
unpow295.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
clear-num98.8%
associate-/r/99.6%
clear-num99.8%
hypot-udef95.4%
+-commutative95.4%
hypot-udef99.8%
Applied egg-rr99.8%
if 2e-16 < (sin.f64 th) < 0.599999999999999978Initial program 95.8%
associate-*l/95.6%
associate-*r/95.7%
+-commutative95.7%
unpow295.7%
unpow295.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 31.7%
add-sqr-sqrt30.6%
sqrt-unprod59.8%
pow259.8%
Applied egg-rr59.8%
unpow259.8%
rem-sqrt-square60.3%
Simplified60.3%
Final simplification76.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.005)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 5e-52)
(* (sin th) (/ 1.0 (* t_1 (+ (* ky 0.16666666666666666) (/ 1.0 ky)))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 5e-52) {
tmp = sin(th) * (1.0 / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 5e-52) {
tmp = Math.sin(th) * (1.0 / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 5e-52: tmp = math.sin(th) * (1.0 / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 5e-52) tmp = Float64(sin(th) * Float64(1.0 / Float64(t_1 * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.005) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 5e-52) tmp = sin(th) * (1.0 / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-52], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(t$95$1 * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-52}:\\
\;\;\;\;\sin th \cdot \frac{1}{t_1 \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 45.7%
associate-*r/45.8%
unpow245.8%
unpow245.8%
hypot-def45.8%
*-rgt-identity45.8%
hypot-def45.8%
unpow245.8%
unpow245.8%
+-commutative45.8%
unpow245.8%
unpow245.8%
hypot-def45.8%
Simplified45.8%
clear-num45.7%
associate-/r/45.7%
clear-num45.9%
hypot-udef45.9%
+-commutative45.9%
hypot-udef45.9%
Applied egg-rr45.9%
if -0.0050000000000000001 < (sin.f64 ky) < 5e-52Initial program 83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def99.7%
Simplified99.7%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
Simplified99.7%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.5%
if 5e-52 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 68.3%
Final simplification77.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.005)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 5e-52)
(* (sin th) (/ 1.0 (* t_1 (/ 1.0 ky))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 5e-52) {
tmp = sin(th) * (1.0 / (t_1 * (1.0 / ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 5e-52) {
tmp = Math.sin(th) * (1.0 / (t_1 * (1.0 / ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 5e-52: tmp = math.sin(th) * (1.0 / (t_1 * (1.0 / ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 5e-52) tmp = Float64(sin(th) * Float64(1.0 / Float64(t_1 * Float64(1.0 / ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.005) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 5e-52) tmp = sin(th) * (1.0 / (t_1 * (1.0 / ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-52], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(t$95$1 * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-52}:\\
\;\;\;\;\sin th \cdot \frac{1}{t_1 \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 45.7%
associate-*r/45.8%
unpow245.8%
unpow245.8%
hypot-def45.8%
*-rgt-identity45.8%
hypot-def45.8%
unpow245.8%
unpow245.8%
+-commutative45.8%
unpow245.8%
unpow245.8%
hypot-def45.8%
Simplified45.8%
clear-num45.7%
associate-/r/45.7%
clear-num45.9%
hypot-udef45.9%
+-commutative45.9%
hypot-udef45.9%
Applied egg-rr45.9%
if -0.0050000000000000001 < (sin.f64 ky) < 5e-52Initial program 83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def99.7%
Simplified99.7%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
Simplified99.7%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 98.9%
if 5e-52 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 68.3%
Final simplification76.9%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.2%
associate-*l/90.5%
associate-*r/92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.0005)
(fabs (sin th))
(if (<= (sin ky) 1e-62)
(* (sin th) (/ 1.0 (+ (/ (sin kx) ky) (* 0.5 (/ ky kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-62) {
tmp = sin(th) * (1.0 / ((sin(kx) / ky) + (0.5 * (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) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-62) then
tmp = sin(th) * (1.0d0 / ((sin(kx) / ky) + (0.5d0 * (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) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-62) {
tmp = Math.sin(th) * (1.0 / ((Math.sin(kx) / ky) + (0.5 * (ky / kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-62: tmp = math.sin(th) * (1.0 / ((math.sin(kx) / ky) + (0.5 * (ky / kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sin(kx) / ky) + Float64(0.5 * Float64(ky / kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) tmp = sin(th) * (1.0 / ((sin(kx) / ky) + (0.5 * (ky / kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision] + N[(0.5 * N[(ky / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sin kx}{ky} + 0.5 \cdot \frac{ky}{kx}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.0%
sqrt-unprod33.9%
pow233.9%
Applied egg-rr33.9%
*-commutative33.9%
associate-/r/34.0%
*-inverses34.0%
/-rgt-identity34.0%
unpow234.0%
rem-sqrt-square40.0%
Simplified40.0%
if -5.0000000000000001e-4 < (sin.f64 ky) < 1e-62Initial program 83.2%
+-commutative83.2%
unpow283.2%
unpow283.2%
hypot-def99.8%
Simplified99.8%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
*-commutative45.1%
cancel-sign-sub-inv45.1%
associate-*r/45.1%
metadata-eval45.1%
metadata-eval45.1%
Simplified45.1%
Taylor expanded in kx around 0 45.1%
if 1e-62 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 66.7%
Final simplification50.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0005) (fabs (sin th)) (if (<= (sin ky) 1e-62) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-62) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-62) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-62) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-62: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-62) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.7%
associate-*l/99.5%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.0%
sqrt-unprod33.9%
pow233.9%
Applied egg-rr33.9%
*-commutative33.9%
associate-/r/34.0%
*-inverses34.0%
/-rgt-identity34.0%
unpow234.0%
rem-sqrt-square40.0%
Simplified40.0%
if -5.0000000000000001e-4 < (sin.f64 ky) < 1e-62Initial program 83.2%
+-commutative83.2%
unpow283.2%
unpow283.2%
hypot-def99.8%
Simplified99.8%
clear-num99.7%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 41.8%
*-commutative41.8%
associate-*r/44.5%
Simplified44.5%
if 1e-62 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 66.7%
Final simplification49.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -1.75e+159)
t_1
(if (<= ky -190000.0)
(sin th)
(if (<= ky -2.5e-5)
t_1
(if (<= ky -6.4e-80)
(/ th (/ (sin kx) ky))
(if (<= ky -1.95e-147)
t_1
(if (<= ky -9.5e-152)
(* th (/ ky (sin kx)))
(if (<= ky 9.2e-184) (/ (sin th) (/ kx ky)) (sin th))))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -1.75e+159) {
tmp = t_1;
} else if (ky <= -190000.0) {
tmp = sin(th);
} else if (ky <= -2.5e-5) {
tmp = t_1;
} else if (ky <= -6.4e-80) {
tmp = th / (sin(kx) / ky);
} else if (ky <= -1.95e-147) {
tmp = t_1;
} else if (ky <= -9.5e-152) {
tmp = th * (ky / sin(kx));
} else if (ky <= 9.2e-184) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (ky <= (-1.75d+159)) then
tmp = t_1
else if (ky <= (-190000.0d0)) then
tmp = sin(th)
else if (ky <= (-2.5d-5)) then
tmp = t_1
else if (ky <= (-6.4d-80)) then
tmp = th / (sin(kx) / ky)
else if (ky <= (-1.95d-147)) then
tmp = t_1
else if (ky <= (-9.5d-152)) then
tmp = th * (ky / sin(kx))
else if (ky <= 9.2d-184) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (ky <= -1.75e+159) {
tmp = t_1;
} else if (ky <= -190000.0) {
tmp = Math.sin(th);
} else if (ky <= -2.5e-5) {
tmp = t_1;
} else if (ky <= -6.4e-80) {
tmp = th / (Math.sin(kx) / ky);
} else if (ky <= -1.95e-147) {
tmp = t_1;
} else if (ky <= -9.5e-152) {
tmp = th * (ky / Math.sin(kx));
} else if (ky <= 9.2e-184) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -1.75e+159: tmp = t_1 elif ky <= -190000.0: tmp = math.sin(th) elif ky <= -2.5e-5: tmp = t_1 elif ky <= -6.4e-80: tmp = th / (math.sin(kx) / ky) elif ky <= -1.95e-147: tmp = t_1 elif ky <= -9.5e-152: tmp = th * (ky / math.sin(kx)) elif ky <= 9.2e-184: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -1.75e+159) tmp = t_1; elseif (ky <= -190000.0) tmp = sin(th); elseif (ky <= -2.5e-5) tmp = t_1; elseif (ky <= -6.4e-80) tmp = Float64(th / Float64(sin(kx) / ky)); elseif (ky <= -1.95e-147) tmp = t_1; elseif (ky <= -9.5e-152) tmp = Float64(th * Float64(ky / sin(kx))); elseif (ky <= 9.2e-184) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -1.75e+159) tmp = t_1; elseif (ky <= -190000.0) tmp = sin(th); elseif (ky <= -2.5e-5) tmp = t_1; elseif (ky <= -6.4e-80) tmp = th / (sin(kx) / ky); elseif (ky <= -1.95e-147) tmp = t_1; elseif (ky <= -9.5e-152) tmp = th * (ky / sin(kx)); elseif (ky <= 9.2e-184) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -1.75e+159], t$95$1, If[LessEqual[ky, -190000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -2.5e-5], t$95$1, If[LessEqual[ky, -6.4e-80], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -1.95e-147], t$95$1, If[LessEqual[ky, -9.5e-152], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 9.2e-184], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -1.75 \cdot 10^{+159}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -190000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -2.5 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -6.4 \cdot 10^{-80}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;ky \leq -1.95 \cdot 10^{-147}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -9.5 \cdot 10^{-152}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 9.2 \cdot 10^{-184}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.75e159 or -1.9e5 < ky < -2.50000000000000012e-5 or -6.3999999999999998e-80 < ky < -1.9499999999999999e-147Initial program 99.7%
associate-*l/98.1%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 18.9%
add-sqr-sqrt12.6%
sqrt-unprod42.6%
pow242.6%
Applied egg-rr42.6%
*-commutative42.6%
associate-/r/42.7%
*-inverses42.7%
/-rgt-identity42.7%
unpow242.7%
rem-sqrt-square44.7%
Simplified44.7%
if -1.75e159 < ky < -1.9e5 or 9.1999999999999998e-184 < ky Initial program 97.5%
+-commutative97.5%
unpow297.5%
unpow297.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 38.1%
if -2.50000000000000012e-5 < ky < -6.3999999999999998e-80Initial program 99.7%
associate-/r/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.4%
Simplified99.4%
Taylor expanded in th around 0 53.0%
associate-*r/53.2%
unpow253.2%
unpow253.2%
hypot-def53.3%
*-rgt-identity53.3%
hypot-def53.2%
unpow253.2%
unpow253.2%
+-commutative53.2%
unpow253.2%
unpow253.2%
hypot-def53.3%
Simplified53.3%
Taylor expanded in ky around 0 15.5%
*-commutative15.5%
associate-/l*19.3%
Simplified19.3%
if -1.9499999999999999e-147 < ky < -9.49999999999999925e-152Initial program 100.0%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 99.0%
associate-*r/99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
*-rgt-identity99.5%
hypot-def99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 36.8%
*-commutative36.8%
associate-/l*36.8%
Simplified36.8%
div-inv36.8%
clear-num36.8%
Applied egg-rr36.8%
if -9.49999999999999925e-152 < ky < 9.1999999999999998e-184Initial program 66.0%
+-commutative66.0%
unpow266.0%
unpow266.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 51.9%
Taylor expanded in kx around 0 42.6%
associate-/l*47.2%
Simplified47.2%
Final simplification39.2%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -1.75e+159)
(fabs (sin th))
(if (<= ky -3.1)
(sin th)
(if (<= ky -6.2e-133)
(fabs (* th (/ ky (sin kx))))
(if (<= ky 6.1e-183) (/ (sin th) (/ kx ky)) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.75e+159) {
tmp = fabs(sin(th));
} else if (ky <= -3.1) {
tmp = sin(th);
} else if (ky <= -6.2e-133) {
tmp = fabs((th * (ky / sin(kx))));
} else if (ky <= 6.1e-183) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.75d+159)) then
tmp = abs(sin(th))
else if (ky <= (-3.1d0)) then
tmp = sin(th)
else if (ky <= (-6.2d-133)) then
tmp = abs((th * (ky / sin(kx))))
else if (ky <= 6.1d-183) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.75e+159) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= -3.1) {
tmp = Math.sin(th);
} else if (ky <= -6.2e-133) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else if (ky <= 6.1e-183) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.75e+159: tmp = math.fabs(math.sin(th)) elif ky <= -3.1: tmp = math.sin(th) elif ky <= -6.2e-133: tmp = math.fabs((th * (ky / math.sin(kx)))) elif ky <= 6.1e-183: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.75e+159) tmp = abs(sin(th)); elseif (ky <= -3.1) tmp = sin(th); elseif (ky <= -6.2e-133) tmp = abs(Float64(th * Float64(ky / sin(kx)))); elseif (ky <= 6.1e-183) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.75e+159) tmp = abs(sin(th)); elseif (ky <= -3.1) tmp = sin(th); elseif (ky <= -6.2e-133) tmp = abs((th * (ky / sin(kx)))); elseif (ky <= 6.1e-183) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.75e+159], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, -3.1], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -6.2e-133], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 6.1e-183], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.75 \cdot 10^{+159}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq -3.1:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -6.2 \cdot 10^{-133}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;ky \leq 6.1 \cdot 10^{-183}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.75e159Initial program 99.6%
associate-*l/99.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 28.5%
add-sqr-sqrt19.5%
sqrt-unprod45.4%
pow245.4%
Applied egg-rr45.4%
*-commutative45.4%
associate-/r/45.4%
*-inverses45.4%
/-rgt-identity45.4%
unpow245.4%
rem-sqrt-square48.8%
Simplified48.8%
if -1.75e159 < ky < -3.10000000000000009 or 6.1000000000000002e-183 < ky Initial program 97.5%
+-commutative97.5%
unpow297.5%
unpow297.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.8%
if -3.10000000000000009 < ky < -6.20000000000000032e-133Initial program 99.8%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 53.6%
associate-*r/53.8%
unpow253.8%
unpow253.8%
hypot-def53.8%
*-rgt-identity53.8%
hypot-def53.8%
unpow253.8%
unpow253.8%
+-commutative53.8%
unpow253.8%
unpow253.8%
hypot-def53.8%
Simplified53.8%
Taylor expanded in ky around 0 16.9%
*-commutative16.9%
associate-/l*19.5%
Simplified19.5%
add-sqr-sqrt18.1%
sqrt-unprod17.1%
pow217.1%
associate-/r/17.2%
Applied egg-rr17.2%
unpow217.2%
rem-sqrt-square30.3%
associate-*l/27.6%
*-commutative27.6%
associate-/l*30.2%
Simplified30.2%
associate-/r/30.2%
Applied egg-rr30.2%
if -6.20000000000000032e-133 < ky < 6.1000000000000002e-183Initial program 70.8%
+-commutative70.8%
unpow270.8%
unpow270.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 50.2%
Taylor expanded in kx around 0 38.9%
associate-/l*42.8%
Simplified42.8%
Final simplification39.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -190000.0) (sin th) (if (<= ky 8e-63) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -190000.0) {
tmp = sin(th);
} else if (ky <= 8e-63) {
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 <= (-190000.0d0)) then
tmp = sin(th)
else if (ky <= 8d-63) 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 <= -190000.0) {
tmp = Math.sin(th);
} else if (ky <= 8e-63) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -190000.0: tmp = math.sin(th) elif ky <= 8e-63: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -190000.0) tmp = sin(th); elseif (ky <= 8e-63) 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 <= -190000.0) tmp = sin(th); elseif (ky <= 8e-63) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -190000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 8e-63], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -190000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{-63}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.9e5 or 8.00000000000000053e-63 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.3%
if -1.9e5 < ky < 8.00000000000000053e-63Initial program 83.5%
associate-/r/83.4%
+-commutative83.4%
unpow283.4%
unpow283.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 47.6%
associate-*r/47.7%
unpow247.7%
unpow247.7%
hypot-def52.6%
*-rgt-identity52.6%
hypot-def47.7%
unpow247.7%
unpow247.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-def52.6%
Simplified52.6%
Taylor expanded in ky around 0 26.7%
*-commutative26.7%
associate-/l*29.3%
Simplified29.3%
div-inv29.3%
clear-num29.3%
Applied egg-rr29.3%
Final simplification33.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -190000.0) (sin th) (if (<= ky 8e-63) (/ th (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -190000.0) {
tmp = sin(th);
} else if (ky <= 8e-63) {
tmp = th / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-190000.0d0)) then
tmp = sin(th)
else if (ky <= 8d-63) then
tmp = th / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -190000.0) {
tmp = Math.sin(th);
} else if (ky <= 8e-63) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -190000.0: tmp = math.sin(th) elif ky <= 8e-63: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -190000.0) tmp = sin(th); elseif (ky <= 8e-63) tmp = Float64(th / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -190000.0) tmp = sin(th); elseif (ky <= 8e-63) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -190000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 8e-63], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -190000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{-63}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.9e5 or 8.00000000000000053e-63 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.3%
if -1.9e5 < ky < 8.00000000000000053e-63Initial program 83.5%
associate-/r/83.4%
+-commutative83.4%
unpow283.4%
unpow283.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 47.6%
associate-*r/47.7%
unpow247.7%
unpow247.7%
hypot-def52.6%
*-rgt-identity52.6%
hypot-def47.7%
unpow247.7%
unpow247.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-def52.6%
Simplified52.6%
Taylor expanded in ky around 0 26.7%
*-commutative26.7%
associate-/l*29.3%
Simplified29.3%
Final simplification33.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -190000.0) (sin th) (if (<= ky 7.5e-183) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -190000.0) {
tmp = sin(th);
} else if (ky <= 7.5e-183) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-190000.0d0)) then
tmp = sin(th)
else if (ky <= 7.5d-183) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -190000.0) {
tmp = Math.sin(th);
} else if (ky <= 7.5e-183) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -190000.0: tmp = math.sin(th) elif ky <= 7.5e-183: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -190000.0) tmp = sin(th); elseif (ky <= 7.5e-183) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -190000.0) tmp = sin(th); elseif (ky <= 7.5e-183) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -190000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 7.5e-183], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -190000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-183}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.9e5 or 7.5000000000000004e-183 < ky Initial program 97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 36.4%
if -1.9e5 < ky < 7.5000000000000004e-183Initial program 82.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 40.2%
Taylor expanded in kx around 0 27.3%
associate-/l*30.7%
Simplified30.7%
Final simplification34.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -0.00078) (sin th) (if (<= ky 4e-184) (/ th (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.00078) {
tmp = sin(th);
} else if (ky <= 4e-184) {
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 <= (-0.00078d0)) then
tmp = sin(th)
else if (ky <= 4d-184) 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 <= -0.00078) {
tmp = Math.sin(th);
} else if (ky <= 4e-184) {
tmp = th / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.00078: tmp = math.sin(th) elif ky <= 4e-184: tmp = th / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.00078) tmp = sin(th); elseif (ky <= 4e-184) 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 <= -0.00078) tmp = sin(th); elseif (ky <= 4e-184) tmp = th / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.00078], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 4e-184], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.00078:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4 \cdot 10^{-184}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -7.79999999999999986e-4 or 4.0000000000000002e-184 < ky Initial program 97.9%
+-commutative97.9%
unpow297.9%
unpow297.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 36.0%
if -7.79999999999999986e-4 < ky < 4.0000000000000002e-184Initial program 81.7%
associate-/r/81.6%
+-commutative81.6%
unpow281.6%
unpow281.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 46.5%
associate-*r/46.6%
unpow246.6%
unpow246.6%
hypot-def50.9%
*-rgt-identity50.9%
hypot-def46.6%
unpow246.6%
unpow246.6%
+-commutative46.6%
unpow246.6%
unpow246.6%
hypot-def50.9%
Simplified50.9%
Taylor expanded in ky around 0 26.2%
*-commutative26.2%
associate-/l*29.7%
Simplified29.7%
Taylor expanded in kx around 0 25.2%
Final simplification32.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.32e+16) th (if (<= ky 1e-62) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.32e+16) {
tmp = th;
} else if (ky <= 1e-62) {
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.32d+16)) then
tmp = th
else if (ky <= 1d-62) 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.32e+16) {
tmp = th;
} else if (ky <= 1e-62) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.32e+16: tmp = th elif ky <= 1e-62: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.32e+16) tmp = th; elseif (ky <= 1e-62) 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.32e+16) tmp = th; elseif (ky <= 1e-62) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.32e+16], th, If[LessEqual[ky, 1e-62], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.32 \cdot 10^{+16}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 10^{-62}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.32e16 or 1e-62 < ky Initial program 99.7%
associate-*l/99.6%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.7%
Taylor expanded in th around 0 21.1%
if -1.32e16 < ky < 1e-62Initial program 84.2%
associate-/r/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 48.1%
associate-*r/48.2%
unpow248.2%
unpow248.2%
hypot-def53.0%
*-rgt-identity53.0%
hypot-def48.2%
unpow248.2%
unpow248.2%
+-commutative48.2%
unpow248.2%
unpow248.2%
hypot-def53.0%
Simplified53.0%
Taylor expanded in ky around 0 25.8%
*-commutative25.8%
associate-/l*28.3%
Simplified28.3%
Taylor expanded in kx around 0 20.6%
associate-/l*23.0%
Simplified23.0%
associate-/r/23.1%
Applied egg-rr23.1%
Final simplification22.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.32e+16) th (if (<= ky 5.5e-62) (/ th (/ kx ky)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.32e+16) {
tmp = th;
} else if (ky <= 5.5e-62) {
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 <= (-1.32d+16)) then
tmp = th
else if (ky <= 5.5d-62) 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 <= -1.32e+16) {
tmp = th;
} else if (ky <= 5.5e-62) {
tmp = th / (kx / ky);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.32e+16: tmp = th elif ky <= 5.5e-62: tmp = th / (kx / ky) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.32e+16) tmp = th; elseif (ky <= 5.5e-62) 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 <= -1.32e+16) tmp = th; elseif (ky <= 5.5e-62) tmp = th / (kx / ky); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.32e+16], th, If[LessEqual[ky, 5.5e-62], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.32 \cdot 10^{+16}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 5.5 \cdot 10^{-62}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.32e16 or 5.50000000000000022e-62 < ky Initial program 99.7%
associate-*l/99.6%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.7%
Taylor expanded in th around 0 21.1%
if -1.32e16 < ky < 5.50000000000000022e-62Initial program 84.2%
associate-/r/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 48.1%
associate-*r/48.2%
unpow248.2%
unpow248.2%
hypot-def53.0%
*-rgt-identity53.0%
hypot-def48.2%
unpow248.2%
unpow248.2%
+-commutative48.2%
unpow248.2%
unpow248.2%
hypot-def53.0%
Simplified53.0%
Taylor expanded in ky around 0 25.8%
*-commutative25.8%
associate-/l*28.3%
Simplified28.3%
Taylor expanded in kx around 0 23.1%
Final simplification22.1%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 92.2%
associate-*l/90.5%
associate-*r/92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 25.0%
Taylor expanded in th around 0 14.3%
Final simplification14.3%
herbie shell --seed 2023238
(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)))