
(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 24 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 th) (/ (hypot (sin kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Initial program 91.9%
*-commutative91.9%
clear-num91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-udef99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.21)
(fabs th)
(if (<= (sin ky) 2e-5)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.21) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.21) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.21: tmp = math.fabs(th) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.21) tmp = abs(th); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.21) tmp = abs(th); elseif (sin(ky) <= 2e-5) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.21], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.21:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.209999999999999992Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.8%
+-commutative40.8%
Simplified40.8%
Taylor expanded in kx around 0 3.1%
associate-*l*3.1%
lft-mult-inverse3.1%
*-rgt-identity3.1%
add-sqr-sqrt1.2%
sqrt-unprod10.4%
pow210.4%
Applied egg-rr10.4%
unpow210.4%
rem-sqrt-square19.9%
Simplified19.9%
if -0.209999999999999992 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 85.5%
+-commutative85.5%
unpow285.5%
unpow285.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 90.4%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification69.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.02)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 2e-5) (* (sin th) (/ ky t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) * (ky / t_1);
} 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.02) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) * (ky / t_1);
} 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.02: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) * (ky / t_1) 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.02) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) * Float64(ky / t_1)); 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.02) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 2e-5) tmp = sin(th) * (ky / t_1); 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.02], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $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.02:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 39.7%
+-commutative39.7%
Simplified39.7%
expm1-log1p-u38.4%
expm1-udef4.7%
sqrt-div4.7%
metadata-eval4.7%
+-commutative4.7%
unpow24.7%
unpow24.7%
hypot-udef4.7%
un-div-inv4.7%
Applied egg-rr4.7%
expm1-def38.5%
expm1-log1p39.8%
hypot-def39.8%
unpow239.8%
unpow239.8%
+-commutative39.8%
unpow239.8%
unpow239.8%
hypot-def39.8%
Simplified39.8%
if -0.0200000000000000004 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.0%
+-commutative84.0%
unpow284.0%
unpow284.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 99.0%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-5)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-5) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.9%
+-commutative40.9%
Simplified40.9%
expm1-log1p-u39.6%
expm1-udef4.8%
sqrt-div4.8%
metadata-eval4.8%
+-commutative4.8%
unpow24.8%
unpow24.8%
hypot-udef4.8%
un-div-inv4.8%
Applied egg-rr4.8%
expm1-def39.7%
expm1-log1p41.0%
hypot-def41.0%
unpow241.0%
unpow241.0%
+-commutative41.0%
unpow241.0%
unpow241.0%
hypot-def41.0%
Simplified41.0%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-5)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-5) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-5: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-5) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.9%
+-commutative40.9%
Simplified40.9%
expm1-log1p-u39.6%
expm1-udef4.8%
sqrt-div4.8%
metadata-eval4.8%
+-commutative4.8%
unpow24.8%
unpow24.8%
hypot-udef4.8%
un-div-inv4.8%
Applied egg-rr4.8%
expm1-def39.7%
expm1-log1p41.0%
hypot-def41.0%
unpow241.0%
unpow241.0%
+-commutative41.0%
unpow241.0%
unpow241.0%
hypot-def41.0%
Simplified41.0%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
associate-*l/79.0%
*-commutative79.0%
associate-*l/84.3%
+-commutative84.3%
unpow284.3%
unpow284.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 2e-5)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 2e-5) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 2e-5: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 2e-5) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
associate-*l/99.8%
expm1-log1p-u99.7%
expm1-udef64.0%
Applied egg-rr63.9%
expm1-def99.6%
expm1-log1p99.7%
Simplified99.7%
Taylor expanded in th around 0 40.9%
associate-*l/41.0%
unpow241.0%
unpow241.0%
hypot-def41.0%
*-lft-identity41.0%
Simplified41.0%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
associate-*l/79.0%
*-commutative79.0%
associate-*l/84.3%
+-commutative84.3%
unpow284.3%
unpow284.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 2e-5)
(/ (sin th) (/ (hypot (sin kx) ky) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 2e-5) tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
associate-*l/99.8%
expm1-log1p-u99.7%
expm1-udef64.0%
Applied egg-rr63.9%
expm1-def99.6%
expm1-log1p99.7%
Simplified99.7%
Taylor expanded in th around 0 40.9%
associate-*l/41.0%
unpow241.0%
unpow241.0%
hypot-def41.0%
*-lft-identity41.0%
Simplified41.0%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
*-commutative84.2%
clear-num84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(/ (* th (sin ky)) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 2e-5)
(/ (sin th) (/ (hypot (sin kx) ky) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = (th * sin(ky)) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = (th * sin(ky)) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 2e-5) tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.9%
+-commutative40.9%
Simplified40.9%
expm1-log1p-u39.8%
expm1-udef4.9%
Applied egg-rr4.9%
expm1-def40.0%
expm1-log1p41.1%
associate-*r/41.1%
hypot-def41.0%
unpow241.0%
unpow241.0%
+-commutative41.0%
unpow241.0%
unpow241.0%
hypot-def41.1%
Simplified41.1%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
*-commutative84.2%
clear-num84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification75.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.045)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 2e-5)
(/ (sin th) (/ (hypot (sin kx) ky) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.045) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 2e-5) {
tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.045) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 2e-5) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.045: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 2e-5: tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.045) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 2e-5) tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.045) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 2e-5) tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.045], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-5], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.045:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.044999999999999998Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
associate-*l/99.8%
expm1-log1p-u99.7%
expm1-udef64.0%
Applied egg-rr63.9%
expm1-def99.6%
expm1-log1p99.7%
Simplified99.7%
Taylor expanded in th around 0 41.5%
+-commutative41.5%
unpow241.5%
unpow241.5%
hypot-def41.5%
associate-*r*41.5%
unpow241.5%
unpow241.5%
hypot-def41.5%
distribute-rgt-out41.5%
Simplified41.5%
if -0.044999999999999998 < (sin.f64 ky) < 2.00000000000000016e-5Initial program 84.2%
*-commutative84.2%
clear-num84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 98.1%
if 2.00000000000000016e-5 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 65.1%
Final simplification76.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.13)
(fabs th)
(if (<= (sin ky) 2e-67)
(/ (sin th) (+ (* 0.5 (/ ky (sin kx))) (/ (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.13) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = sin(th) / ((0.5 * (ky / sin(kx))) + (sin(kx) / ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.13d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = sin(th) / ((0.5d0 * (ky / sin(kx))) + (sin(kx) / ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.13) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = Math.sin(th) / ((0.5 * (ky / Math.sin(kx))) + (Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.13: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = math.sin(th) / ((0.5 * (ky / math.sin(kx))) + (math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.13) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(sin(th) / Float64(Float64(0.5 * Float64(ky / sin(kx))) + Float64(sin(kx) / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.13) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = sin(th) / ((0.5 * (ky / sin(kx))) + (sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.13], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(N[Sin[th], $MachinePrecision] / N[(N[(0.5 * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.13:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sin th}{0.5 \cdot \frac{ky}{\sin kx} + \frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.13Initial program 99.8%
associate-*l/99.7%
*-commutative99.7%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in kx around 0 3.2%
associate-*l*3.2%
lft-mult-inverse3.2%
*-rgt-identity3.2%
add-sqr-sqrt1.3%
sqrt-unprod10.1%
pow210.1%
Applied egg-rr10.1%
unpow210.1%
rem-sqrt-square18.7%
Simplified18.7%
if -0.13 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.4%
*-commutative82.4%
clear-num82.4%
+-commutative82.4%
unpow282.4%
unpow282.4%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 93.3%
Taylor expanded in ky around 0 55.1%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.15) (fabs th) (if (<= (sin ky) 2e-67) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = sin(th) * (sin(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) <= (-0.15d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = sin(th) * (sin(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) <= -0.15) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.15: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.15:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.6%
+-commutative41.6%
Simplified41.6%
Taylor expanded in kx around 0 3.2%
associate-*l*3.2%
lft-mult-inverse3.2%
*-rgt-identity3.2%
add-sqr-sqrt1.3%
sqrt-unprod10.1%
pow210.1%
Applied egg-rr10.1%
unpow210.1%
rem-sqrt-square19.0%
Simplified19.0%
if -0.149999999999999994 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.7%
Taylor expanded in ky around 0 54.4%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.15) (fabs th) (if (<= (sin ky) 2e-67) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = sin(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.15d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = sin(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.15) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = Math.sin(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.15: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = math.sin(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.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(sin(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.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = sin(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.15], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(N[Sin[ky], $MachinePrecision] * 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.15:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.6%
+-commutative41.6%
Simplified41.6%
Taylor expanded in kx around 0 3.2%
associate-*l*3.2%
lft-mult-inverse3.2%
*-rgt-identity3.2%
add-sqr-sqrt1.3%
sqrt-unprod10.1%
pow210.1%
Applied egg-rr10.1%
unpow210.1%
rem-sqrt-square19.0%
Simplified19.0%
if -0.149999999999999994 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.7%
associate-*l/77.5%
*-commutative77.5%
associate-*l/82.7%
+-commutative82.7%
unpow282.7%
unpow282.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.5%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.15) (fabs th) (if (<= (sin ky) 2e-67) (/ (sin th) (/ (sin kx) (sin ky))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.15d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = sin(th) / (sin(kx) / sin(ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.15) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.15: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.15) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = sin(th) / (sin(kx) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.15:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.6%
+-commutative41.6%
Simplified41.6%
Taylor expanded in kx around 0 3.2%
associate-*l*3.2%
lft-mult-inverse3.2%
*-rgt-identity3.2%
add-sqr-sqrt1.3%
sqrt-unprod10.1%
pow210.1%
Applied egg-rr10.1%
unpow210.1%
rem-sqrt-square19.0%
Simplified19.0%
if -0.149999999999999994 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.7%
*-commutative82.7%
clear-num82.7%
+-commutative82.7%
unpow282.7%
unpow282.7%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 54.4%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.09) (fabs th) (if (<= (sin ky) 2e-67) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.09) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
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) <= (-0.09d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) 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) <= -0.09) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
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) <= -0.09: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: 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) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) 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) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) 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], -0.09], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], 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 -0.09:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.089999999999999997Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in kx around 0 3.1%
associate-*l*3.1%
lft-mult-inverse3.1%
*-rgt-identity3.1%
add-sqr-sqrt1.3%
sqrt-unprod9.8%
pow29.8%
Applied egg-rr9.8%
unpow29.8%
rem-sqrt-square18.1%
Simplified18.1%
if -0.089999999999999997 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.5%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.09) (fabs th) (if (<= (sin ky) 2e-67) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.09) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.09d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.09) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.09: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.09], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.09:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.089999999999999997Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in kx around 0 3.1%
associate-*l*3.1%
lft-mult-inverse3.1%
*-rgt-identity3.1%
add-sqr-sqrt1.3%
sqrt-unprod9.8%
pow29.8%
Applied egg-rr9.8%
unpow29.8%
rem-sqrt-square18.1%
Simplified18.1%
if -0.089999999999999997 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.1%
Taylor expanded in ky around 0 51.7%
associate-/l*55.5%
Simplified55.5%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.09) (fabs th) (if (<= (sin ky) 2e-67) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.09) {
tmp = fabs(th);
} else if (sin(ky) <= 2e-67) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.09d0)) then
tmp = abs(th)
else if (sin(ky) <= 2d-67) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.09) {
tmp = Math.abs(th);
} else if (Math.sin(ky) <= 2e-67) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.09: tmp = math.fabs(th) elif math.sin(ky) <= 2e-67: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.09) tmp = abs(th); elseif (sin(ky) <= 2e-67) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.09], N[Abs[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-67], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.09:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.089999999999999997Initial program 99.8%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in kx around 0 3.1%
associate-*l*3.1%
lft-mult-inverse3.1%
*-rgt-identity3.1%
add-sqr-sqrt1.3%
sqrt-unprod9.8%
pow29.8%
Applied egg-rr9.8%
unpow29.8%
rem-sqrt-square18.1%
Simplified18.1%
if -0.089999999999999997 < (sin.f64 ky) < 1.99999999999999989e-67Initial program 82.1%
*-commutative82.1%
clear-num82.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 55.5%
if 1.99999999999999989e-67 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.1%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -3.4e+15) (not (<= ky 2.9e-97))) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 2.9e-97)) {
tmp = sin(th);
} else {
tmp = th * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-3.4d+15)) .or. (.not. (ky <= 2.9d-97))) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 2.9e-97)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -3.4e+15) or not (ky <= 2.9e-97): tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -3.4e+15) || !(ky <= 2.9e-97)) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -3.4e+15) || ~((ky <= 2.9e-97))) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -3.4e+15], N[Not[LessEqual[ky, 2.9e-97]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.4 \cdot 10^{+15} \lor \neg \left(ky \leq 2.9 \cdot 10^{-97}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if ky < -3.4e15 or 2.8999999999999999e-97 < ky Initial program 99.7%
Taylor expanded in kx around 0 37.4%
if -3.4e15 < ky < 2.8999999999999999e-97Initial program 80.4%
associate-*l/76.3%
*-commutative76.3%
associate-*l/80.5%
+-commutative80.5%
unpow280.5%
unpow280.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 44.7%
+-commutative44.7%
Simplified44.7%
Taylor expanded in ky around 0 36.2%
associate-/l*40.2%
Simplified40.2%
associate-/r/40.2%
Applied egg-rr40.2%
Final simplification38.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -3.4e+15) (not (<= ky 2.65e-97))) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 2.65e-97)) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-3.4d+15)) .or. (.not. (ky <= 2.65d-97))) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 2.65e-97)) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -3.4e+15) or not (ky <= 2.65e-97): tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -3.4e+15) || !(ky <= 2.65e-97)) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -3.4e+15) || ~((ky <= 2.65e-97))) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -3.4e+15], N[Not[LessEqual[ky, 2.65e-97]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.4 \cdot 10^{+15} \lor \neg \left(ky \leq 2.65 \cdot 10^{-97}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if ky < -3.4e15 or 2.64999999999999996e-97 < ky Initial program 99.7%
Taylor expanded in kx around 0 37.4%
if -3.4e15 < ky < 2.64999999999999996e-97Initial program 80.4%
associate-*l/76.3%
*-commutative76.3%
associate-*l/80.5%
+-commutative80.5%
unpow280.5%
unpow280.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 44.7%
+-commutative44.7%
Simplified44.7%
Taylor expanded in ky around 0 36.2%
associate-/l*40.2%
Simplified40.2%
clear-num40.1%
associate-/r/40.2%
clear-num40.2%
Applied egg-rr40.2%
Final simplification38.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -3.4e+15) (not (<= ky 3.4e-154))) (sin th) (* ky (/ th kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 3.4e-154)) {
tmp = sin(th);
} else {
tmp = ky * (th / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-3.4d+15)) .or. (.not. (ky <= 3.4d-154))) then
tmp = sin(th)
else
tmp = ky * (th / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3.4e+15) || !(ky <= 3.4e-154)) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -3.4e+15) or not (ky <= 3.4e-154): tmp = math.sin(th) else: tmp = ky * (th / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -3.4e+15) || !(ky <= 3.4e-154)) tmp = sin(th); else tmp = Float64(ky * Float64(th / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -3.4e+15) || ~((ky <= 3.4e-154))) tmp = sin(th); else tmp = ky * (th / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -3.4e+15], N[Not[LessEqual[ky, 3.4e-154]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.4 \cdot 10^{+15} \lor \neg \left(ky \leq 3.4 \cdot 10^{-154}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\end{array}
\end{array}
if ky < -3.4e15 or 3.3999999999999998e-154 < ky Initial program 99.7%
Taylor expanded in kx around 0 36.8%
if -3.4e15 < ky < 3.3999999999999998e-154Initial program 78.6%
associate-*l/74.1%
*-commutative74.1%
associate-*l/78.7%
+-commutative78.7%
unpow278.7%
unpow278.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 43.6%
+-commutative43.6%
Simplified43.6%
Taylor expanded in ky around 0 37.2%
associate-/l*41.5%
Simplified41.5%
Taylor expanded in kx around 0 31.8%
associate-/l*36.1%
Simplified36.1%
div-inv36.1%
clear-num36.1%
*-commutative36.1%
Applied egg-rr36.1%
Final simplification36.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.55e-149) (fabs th) (if (<= ky 4.5e-93) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.55e-149) {
tmp = fabs(th);
} else if (ky <= 4.5e-93) {
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.55d-149)) then
tmp = abs(th)
else if (ky <= 4.5d-93) 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.55e-149) {
tmp = Math.abs(th);
} else if (ky <= 4.5e-93) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.55e-149: tmp = math.fabs(th) elif ky <= 4.5e-93: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.55e-149) tmp = abs(th); elseif (ky <= 4.5e-93) 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.55e-149) tmp = abs(th); elseif (ky <= 4.5e-93) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.55e-149], N[Abs[th], $MachinePrecision], If[LessEqual[ky, 4.5e-93], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.55 \cdot 10^{-149}:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;ky \leq 4.5 \cdot 10^{-93}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.54999999999999994e-149Initial program 99.7%
associate-*l/96.3%
*-commutative96.3%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 39.5%
+-commutative39.5%
Simplified39.5%
Taylor expanded in kx around 0 11.1%
associate-*l*11.2%
lft-mult-inverse11.2%
*-rgt-identity11.2%
add-sqr-sqrt4.9%
sqrt-unprod7.9%
pow27.9%
Applied egg-rr7.9%
unpow27.9%
rem-sqrt-square15.0%
Simplified15.0%
if -1.54999999999999994e-149 < ky < 4.5000000000000002e-93Initial program 74.3%
associate-*l/72.4%
*-commutative72.4%
associate-*l/74.3%
+-commutative74.3%
unpow274.3%
unpow274.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.2%
+-commutative49.2%
Simplified49.2%
Taylor expanded in ky around 0 44.3%
associate-/l*49.4%
Simplified49.4%
Taylor expanded in kx around 0 38.8%
associate-/l*44.0%
Simplified44.0%
associate-/r/44.1%
Applied egg-rr44.1%
if 4.5000000000000002e-93 < ky Initial program 99.7%
associate-*l/97.0%
*-commutative97.0%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 50.2%
+-commutative50.2%
Simplified50.2%
Taylor expanded in kx around 0 23.7%
Final simplification27.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.3e-50) th (if (<= ky 1.8e-94) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.3e-50) {
tmp = th;
} else if (ky <= 1.8e-94) {
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.3d-50)) then
tmp = th
else if (ky <= 1.8d-94) 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.3e-50) {
tmp = th;
} else if (ky <= 1.8e-94) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.3e-50: tmp = th elif ky <= 1.8e-94: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.3e-50) tmp = th; elseif (ky <= 1.8e-94) 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.3e-50) tmp = th; elseif (ky <= 1.8e-94) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.3e-50], th, If[LessEqual[ky, 1.8e-94], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.3 \cdot 10^{-50}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-94}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.3000000000000001e-50 or 1.8e-94 < ky Initial program 99.7%
associate-*l/98.1%
*-commutative98.1%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 45.3%
+-commutative45.3%
Simplified45.3%
Taylor expanded in kx around 0 19.3%
if -1.3000000000000001e-50 < ky < 1.8e-94Initial program 78.8%
associate-*l/74.3%
*-commutative74.3%
associate-*l/78.8%
+-commutative78.8%
unpow278.8%
unpow278.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 48.2%
+-commutative48.2%
Simplified48.2%
Taylor expanded in ky around 0 39.0%
associate-/l*43.2%
Simplified43.2%
Taylor expanded in kx around 0 32.7%
associate-/l*37.0%
Simplified37.0%
associate-/r/37.1%
Applied egg-rr37.1%
Final simplification26.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.3e-50) th (if (<= ky 1.1e-93) (* ky (/ th kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.3e-50) {
tmp = th;
} else if (ky <= 1.1e-93) {
tmp = ky * (th / 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.3d-50)) then
tmp = th
else if (ky <= 1.1d-93) then
tmp = ky * (th / 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.3e-50) {
tmp = th;
} else if (ky <= 1.1e-93) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.3e-50: tmp = th elif ky <= 1.1e-93: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.3e-50) tmp = th; elseif (ky <= 1.1e-93) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.3e-50) tmp = th; elseif (ky <= 1.1e-93) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.3e-50], th, If[LessEqual[ky, 1.1e-93], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.3 \cdot 10^{-50}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.1 \cdot 10^{-93}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.3000000000000001e-50 or 1.09999999999999998e-93 < ky Initial program 99.7%
associate-*l/98.1%
*-commutative98.1%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 45.3%
+-commutative45.3%
Simplified45.3%
Taylor expanded in kx around 0 19.3%
if -1.3000000000000001e-50 < ky < 1.09999999999999998e-93Initial program 78.8%
associate-*l/74.3%
*-commutative74.3%
associate-*l/78.8%
+-commutative78.8%
unpow278.8%
unpow278.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 48.2%
+-commutative48.2%
Simplified48.2%
Taylor expanded in ky around 0 39.0%
associate-/l*43.2%
Simplified43.2%
Taylor expanded in kx around 0 32.7%
associate-/l*37.0%
Simplified37.0%
div-inv37.0%
clear-num37.0%
*-commutative37.0%
Applied egg-rr37.0%
Final simplification25.9%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 91.9%
associate-*l/89.2%
*-commutative89.2%
associate-*l/91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 46.4%
+-commutative46.4%
Simplified46.4%
Taylor expanded in kx around 0 14.1%
Final simplification14.1%
herbie shell --seed 2023305
(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)))