
(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 18 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 92.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/91.1%
associate-/r/91.1%
associate-*l/92.6%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.6%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef92.6%
unpow292.6%
unpow292.6%
+-commutative92.6%
unpow292.6%
unpow292.6%
hypot-def99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(fabs (sin th))
(if (<= (sin ky) 0.002)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 0.002) {
tmp = sin(th) * (ky / hypot(sin(kx), 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.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) * (ky / Math.hypot(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.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 0.002: tmp = math.sin(th) * (ky / math.hypot(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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) * Float64(ky / hypot(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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 0.002) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
associate-*l/99.6%
clear-num99.3%
hypot-udef99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Applied egg-rr99.3%
Taylor expanded in kx around 0 2.4%
remove-double-div2.4%
add-sqr-sqrt1.4%
sqrt-unprod19.5%
pow219.5%
Applied egg-rr19.5%
unpow219.5%
rem-sqrt-square22.8%
Simplified22.8%
if -0.050000000000000003 < (sin.f64 ky) < 2e-3Initial program 85.4%
remove-double-neg85.4%
sin-neg85.4%
neg-mul-185.4%
*-commutative85.4%
associate-*l*85.4%
associate-*l/82.5%
associate-/r/82.5%
associate-*l/85.4%
associate-/r/85.5%
sin-neg85.5%
neg-mul-185.5%
associate-/r*85.5%
associate-/r/85.4%
Simplified99.7%
associate-*l/93.4%
clear-num93.3%
hypot-udef82.3%
unpow282.3%
unpow282.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def93.3%
Applied egg-rr93.3%
Taylor expanded in ky around 0 91.5%
clear-num91.6%
*-commutative91.6%
*-un-lft-identity91.6%
times-frac97.9%
/-rgt-identity97.9%
Applied egg-rr97.9%
if 2e-3 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.7%
Final simplification70.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(/ (sin ky) (/ (hypot (sin ky) (sin kx)) th))
(if (<= (sin ky) 0.002)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th);
} else if (sin(ky) <= 0.002) {
tmp = sin(th) * (ky / hypot(sin(kx), 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.05) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th);
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) * (ky / Math.hypot(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.05: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / th) elif math.sin(ky) <= 0.002: tmp = math.sin(th) * (ky / math.hypot(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.05) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) / th)); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) * Float64(ky / hypot(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.05) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) / th); elseif (sin(ky) <= 0.002) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef50.5%
hypot-udef50.5%
unpow250.5%
unpow250.5%
+-commutative50.5%
unpow250.5%
unpow250.5%
hypot-def50.5%
Applied egg-rr50.5%
expm1-def99.6%
expm1-log1p99.6%
associate-/r/99.5%
hypot-def99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 53.9%
associate-*l/54.0%
unpow254.0%
unpow254.0%
hypot-def54.0%
*-lft-identity54.0%
hypot-def54.0%
unpow254.0%
unpow254.0%
+-commutative54.0%
unpow254.0%
unpow254.0%
hypot-def54.0%
Simplified54.0%
if -0.050000000000000003 < (sin.f64 ky) < 2e-3Initial program 85.4%
remove-double-neg85.4%
sin-neg85.4%
neg-mul-185.4%
*-commutative85.4%
associate-*l*85.4%
associate-*l/82.5%
associate-/r/82.5%
associate-*l/85.4%
associate-/r/85.5%
sin-neg85.5%
neg-mul-185.5%
associate-/r*85.5%
associate-/r/85.4%
Simplified99.7%
associate-*l/93.4%
clear-num93.3%
hypot-udef82.3%
unpow282.3%
unpow282.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def93.3%
Applied egg-rr93.3%
Taylor expanded in ky around 0 91.5%
clear-num91.6%
*-commutative91.6%
*-un-lft-identity91.6%
times-frac97.9%
/-rgt-identity97.9%
Applied egg-rr97.9%
if 2e-3 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.7%
Final simplification78.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ 1.0 (/ (hypot (sin ky) (sin kx)) th)))
(if (<= (sin ky) 0.002)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (1.0 / (hypot(sin(ky), sin(kx)) / th));
} else if (sin(ky) <= 0.002) {
tmp = sin(th) * (ky / hypot(sin(kx), 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.05) {
tmp = Math.sin(ky) * (1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th));
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) * (ky / Math.hypot(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.05: tmp = math.sin(ky) * (1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / th)) elif math.sin(ky) <= 0.002: tmp = math.sin(th) * (ky / math.hypot(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.05) tmp = Float64(sin(ky) * Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / th))); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) * Float64(ky / hypot(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.05) tmp = sin(ky) * (1.0 / (hypot(sin(ky), sin(kx)) / th)); elseif (sin(ky) <= 0.002) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
hypot-udef99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Applied egg-rr99.5%
associate-/r/99.7%
Applied egg-rr99.7%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
hypot-def99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in th around 0 53.9%
associate-*l/54.0%
unpow254.0%
unpow254.0%
hypot-def54.0%
*-lft-identity54.0%
hypot-def54.0%
unpow254.0%
unpow254.0%
+-commutative54.0%
unpow254.0%
unpow254.0%
hypot-def54.0%
Simplified54.0%
if -0.050000000000000003 < (sin.f64 ky) < 2e-3Initial program 85.4%
remove-double-neg85.4%
sin-neg85.4%
neg-mul-185.4%
*-commutative85.4%
associate-*l*85.4%
associate-*l/82.5%
associate-/r/82.5%
associate-*l/85.4%
associate-/r/85.5%
sin-neg85.5%
neg-mul-185.5%
associate-/r*85.5%
associate-/r/85.4%
Simplified99.7%
associate-*l/93.4%
clear-num93.3%
hypot-udef82.3%
unpow282.3%
unpow282.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def93.3%
Applied egg-rr93.3%
Taylor expanded in ky around 0 91.5%
clear-num91.6%
*-commutative91.6%
*-un-lft-identity91.6%
times-frac97.9%
/-rgt-identity97.9%
Applied egg-rr97.9%
if 2e-3 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.7%
Final simplification78.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(/
(sin ky)
(* (hypot (sin ky) (sin kx)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 0.002)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 0.002) {
tmp = sin(th) * (ky / hypot(sin(kx), 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.05) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) * (ky / Math.hypot(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.05: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 0.002: tmp = math.sin(th) * (ky / math.hypot(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.05) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) * Float64(ky / hypot(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.05) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 0.002) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef50.5%
hypot-udef50.5%
unpow250.5%
unpow250.5%
+-commutative50.5%
unpow250.5%
unpow250.5%
hypot-def50.5%
Applied egg-rr50.5%
expm1-def99.6%
expm1-log1p99.6%
associate-/r/99.5%
hypot-def99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 54.7%
+-commutative54.7%
unpow254.7%
unpow254.7%
hypot-def54.8%
associate-*r*54.8%
unpow254.8%
unpow254.8%
hypot-def54.8%
distribute-rgt-out54.8%
Simplified54.8%
if -0.050000000000000003 < (sin.f64 ky) < 2e-3Initial program 85.4%
remove-double-neg85.4%
sin-neg85.4%
neg-mul-185.4%
*-commutative85.4%
associate-*l*85.4%
associate-*l/82.5%
associate-/r/82.5%
associate-*l/85.4%
associate-/r/85.5%
sin-neg85.5%
neg-mul-185.5%
associate-/r*85.5%
associate-/r/85.4%
Simplified99.7%
associate-*l/93.4%
clear-num93.3%
hypot-udef82.3%
unpow282.3%
unpow282.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def93.3%
Applied egg-rr93.3%
Taylor expanded in ky around 0 91.5%
clear-num91.6%
*-commutative91.6%
*-un-lft-identity91.6%
times-frac97.9%
/-rgt-identity97.9%
Applied egg-rr97.9%
if 2e-3 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.7%
Final simplification78.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.015)
(* (sin th) (fabs (/ ky (sin kx))))
(if (<= (sin kx) 1e-9)
(/ 1.0 (/ (sin ky) (* (sin th) (sin ky))))
(/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.015) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else if (sin(kx) <= 1e-9) {
tmp = 1.0 / (sin(ky) / (sin(th) * sin(ky)));
} else {
tmp = sin(ky) / (sin(kx) / 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(kx) <= (-0.015d0)) then
tmp = sin(th) * abs((ky / sin(kx)))
else if (sin(kx) <= 1d-9) then
tmp = 1.0d0 / (sin(ky) / (sin(th) * sin(ky)))
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.015) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-9) {
tmp = 1.0 / (Math.sin(ky) / (Math.sin(th) * Math.sin(ky)));
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.015: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) elif math.sin(kx) <= 1e-9: tmp = 1.0 / (math.sin(ky) / (math.sin(th) * math.sin(ky))) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.015) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); elseif (sin(kx) <= 1e-9) tmp = Float64(1.0 / Float64(sin(ky) / Float64(sin(th) * sin(ky)))); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.015) tmp = sin(th) * abs((ky / sin(kx))); elseif (sin(kx) <= 1e-9) tmp = 1.0 / (sin(ky) / (sin(th) * sin(ky))); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.015], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-9], N[(1.0 / N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.015:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{\sin ky}{\sin th \cdot \sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.014999999999999999Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
div-inv10.9%
*-commutative10.9%
associate-*l*10.9%
Applied egg-rr10.9%
add-sqr-sqrt3.0%
sqrt-unprod25.5%
pow225.5%
un-div-inv25.6%
Applied egg-rr25.6%
unpow225.6%
rem-sqrt-square35.9%
Simplified35.9%
if -0.014999999999999999 < (sin.f64 kx) < 1.00000000000000006e-9Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/83.5%
associate-/r/83.5%
associate-*l/86.4%
associate-/r/86.2%
sin-neg86.2%
neg-mul-186.2%
associate-/r*86.2%
associate-/r/86.4%
Simplified99.9%
associate-*l/93.9%
clear-num93.7%
hypot-udef83.3%
unpow283.3%
unpow283.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-def93.7%
Applied egg-rr93.7%
Taylor expanded in kx around 0 48.8%
if 1.00000000000000006e-9 < (sin.f64 kx) Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.3%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.3%
Simplified99.4%
expm1-log1p-u99.4%
expm1-udef47.1%
hypot-udef47.1%
unpow247.1%
unpow247.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-def47.1%
Applied egg-rr47.1%
expm1-def99.4%
expm1-log1p99.4%
associate-/r/99.6%
hypot-def99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.7%
Final simplification47.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.015) (* (sin th) (fabs (/ ky (sin kx)))) (if (<= (sin kx) 1e-9) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.015) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else if (sin(kx) <= 1e-9) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(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 (sin(kx) <= (-0.015d0)) then
tmp = sin(th) * abs((ky / sin(kx)))
else if (sin(kx) <= 1d-9) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.015) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-9) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.015: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) elif math.sin(kx) <= 1e-9: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.015) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.015) tmp = sin(th) * abs((ky / sin(kx))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.015], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-9], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.015:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-9}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.014999999999999999Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
div-inv10.9%
*-commutative10.9%
associate-*l*10.9%
Applied egg-rr10.9%
add-sqr-sqrt3.0%
sqrt-unprod25.5%
pow225.5%
un-div-inv25.6%
Applied egg-rr25.6%
unpow225.6%
rem-sqrt-square35.9%
Simplified35.9%
if -0.014999999999999999 < (sin.f64 kx) < 1.00000000000000006e-9Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/83.5%
associate-/r/83.5%
associate-*l/86.4%
associate-/r/86.2%
sin-neg86.2%
neg-mul-186.2%
associate-/r*86.2%
associate-/r/86.4%
Simplified99.9%
Taylor expanded in kx around 0 45.9%
if 1.00000000000000006e-9 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 55.6%
Final simplification45.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.015) (* (sin th) (fabs (/ ky (sin kx)))) (if (<= (sin kx) 1e-9) (sin th) (/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.015) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else if (sin(kx) <= 1e-9) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / 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(kx) <= (-0.015d0)) then
tmp = sin(th) * abs((ky / sin(kx)))
else if (sin(kx) <= 1d-9) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.015) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-9) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.015: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) elif math.sin(kx) <= 1e-9: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.015) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.015) tmp = sin(th) * abs((ky / sin(kx))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.015], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-9], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.015:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-9}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.014999999999999999Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
div-inv10.9%
*-commutative10.9%
associate-*l*10.9%
Applied egg-rr10.9%
add-sqr-sqrt3.0%
sqrt-unprod25.5%
pow225.5%
un-div-inv25.6%
Applied egg-rr25.6%
unpow225.6%
rem-sqrt-square35.9%
Simplified35.9%
if -0.014999999999999999 < (sin.f64 kx) < 1.00000000000000006e-9Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/83.5%
associate-/r/83.5%
associate-*l/86.4%
associate-/r/86.2%
sin-neg86.2%
neg-mul-186.2%
associate-/r*86.2%
associate-/r/86.4%
Simplified99.9%
Taylor expanded in kx around 0 45.9%
if 1.00000000000000006e-9 < (sin.f64 kx) Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.3%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.3%
Simplified99.4%
expm1-log1p-u99.4%
expm1-udef47.1%
hypot-udef47.1%
unpow247.1%
unpow247.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-def47.1%
Applied egg-rr47.1%
expm1-def99.4%
expm1-log1p99.4%
associate-/r/99.6%
hypot-def99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.7%
Final simplification45.6%
(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 92.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/91.1%
associate-/r/91.1%
associate-*l/92.6%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.6%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 2e-136) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-136) {
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.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-136) 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.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-136) {
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.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-136: 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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-136) 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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-136) 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.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-136], 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.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-136}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
associate-*l/99.6%
clear-num99.3%
hypot-udef99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Applied egg-rr99.3%
Taylor expanded in kx around 0 2.4%
remove-double-div2.4%
add-sqr-sqrt1.4%
sqrt-unprod19.5%
pow219.5%
Applied egg-rr19.5%
unpow219.5%
rem-sqrt-square22.8%
Simplified22.8%
if -0.050000000000000003 < (sin.f64 ky) < 2e-136Initial program 81.0%
remove-double-neg81.0%
sin-neg81.0%
neg-mul-181.0%
*-commutative81.0%
associate-*l*81.0%
associate-*l/77.6%
associate-/r/77.6%
associate-*l/81.0%
associate-/r/81.0%
sin-neg81.0%
neg-mul-181.0%
associate-/r*81.0%
associate-/r/81.0%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.8%
hypot-udef81.0%
unpow281.0%
unpow281.0%
+-commutative81.0%
unpow281.0%
unpow281.0%
hypot-def99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 35.7%
associate-*r/37.3%
Simplified37.3%
if 2e-136 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.1%
associate-/r/99.1%
associate-*l/99.7%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.9%
Final simplification42.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 2e-136) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-136) {
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.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-136) 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.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-136) {
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.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-136: 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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-136) 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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-136) 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.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-136], 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.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-136}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.6%
associate-*l/99.6%
clear-num99.3%
hypot-udef99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Applied egg-rr99.3%
Taylor expanded in kx around 0 2.4%
remove-double-div2.4%
add-sqr-sqrt1.4%
sqrt-unprod19.5%
pow219.5%
Applied egg-rr19.5%
unpow219.5%
rem-sqrt-square22.8%
Simplified22.8%
if -0.050000000000000003 < (sin.f64 ky) < 2e-136Initial program 81.0%
remove-double-neg81.0%
sin-neg81.0%
neg-mul-181.0%
*-commutative81.0%
associate-*l*81.0%
associate-*l/77.6%
associate-/r/77.6%
associate-*l/81.0%
associate-/r/81.0%
sin-neg81.0%
neg-mul-181.0%
associate-/r*81.0%
associate-/r/81.0%
Simplified99.7%
Taylor expanded in ky around 0 35.7%
associate-/l*37.3%
Simplified37.3%
if 2e-136 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.1%
associate-/r/99.1%
associate-*l/99.7%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.9%
Final simplification42.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.015) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-9) (sin th) (/ ky (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.015) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-9) {
tmp = sin(th);
} else {
tmp = ky / (sin(kx) / 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(kx) <= (-0.015d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-9) then
tmp = sin(th)
else
tmp = ky / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.015) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-9) {
tmp = Math.sin(th);
} else {
tmp = ky / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.015: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-9: tmp = math.sin(th) else: tmp = ky / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.015) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = Float64(ky / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.015) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-9) tmp = sin(th); else tmp = ky / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.015], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-9], N[Sin[th], $MachinePrecision], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.015:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-9}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.014999999999999999Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
add-sqr-sqrt8.9%
sqrt-unprod25.4%
pow225.4%
*-commutative25.4%
associate-/l*25.5%
Applied egg-rr25.5%
unpow225.5%
rem-sqrt-square39.4%
associate-/r/39.4%
*-commutative39.4%
Simplified39.4%
if -0.014999999999999999 < (sin.f64 kx) < 1.00000000000000006e-9Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/83.5%
associate-/r/83.5%
associate-*l/86.4%
associate-/r/86.2%
sin-neg86.2%
neg-mul-186.2%
associate-/r*86.2%
associate-/r/86.4%
Simplified99.9%
Taylor expanded in kx around 0 45.9%
if 1.00000000000000006e-9 < (sin.f64 kx) Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.3%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.3%
Simplified99.4%
Taylor expanded in ky around 0 46.0%
associate-/l*46.1%
Simplified46.1%
Final simplification44.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.25e-9) (sin th) (* (sin th) (fabs (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.25e-9) {
tmp = sin(th);
} else {
tmp = sin(th) * fabs((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 (kx <= 1.25d-9) then
tmp = sin(th)
else
tmp = sin(th) * abs((ky / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.25e-9) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.25e-9: tmp = math.sin(th) else: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.25e-9) tmp = sin(th); else tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.25e-9) tmp = sin(th); else tmp = sin(th) * abs((ky / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.25e-9], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.25 \cdot 10^{-9}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 1.25e-9Initial program 90.5%
remove-double-neg90.5%
sin-neg90.5%
neg-mul-190.5%
*-commutative90.5%
associate-*l*90.5%
associate-*l/88.6%
associate-/r/88.6%
associate-*l/90.5%
associate-/r/90.5%
sin-neg90.5%
neg-mul-190.5%
associate-/r*90.5%
associate-/r/90.5%
Simplified99.8%
Taylor expanded in kx around 0 33.7%
if 1.25e-9 < kx Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.5%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.5%
Simplified99.4%
Taylor expanded in ky around 0 35.7%
div-inv35.7%
*-commutative35.7%
associate-*l*35.6%
Applied egg-rr35.6%
add-sqr-sqrt8.7%
sqrt-unprod23.6%
pow223.6%
un-div-inv23.6%
Applied egg-rr23.6%
unpow223.6%
rem-sqrt-square28.3%
Simplified28.3%
Final simplification32.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.7e-148) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.7e-148) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.7d-148) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.7e-148) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.7e-148: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.7e-148) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.7e-148) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.7e-148], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.7 \cdot 10^{-148}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.69999999999999988e-148Initial program 88.2%
remove-double-neg88.2%
sin-neg88.2%
neg-mul-188.2%
*-commutative88.2%
associate-*l*88.2%
associate-*l/86.1%
associate-/r/86.1%
associate-*l/88.2%
associate-/r/88.1%
sin-neg88.1%
neg-mul-188.1%
associate-/r*88.1%
associate-/r/88.2%
Simplified99.6%
Taylor expanded in ky around 0 23.2%
div-inv23.2%
*-commutative23.2%
associate-*l*24.1%
Applied egg-rr24.1%
Taylor expanded in kx around 0 14.1%
if 2.69999999999999988e-148 < ky Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.2%
associate-/r/99.2%
associate-*l/99.7%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.7%
Simplified99.8%
Taylor expanded in kx around 0 42.6%
Final simplification25.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.6e-147) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-147) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.6d-147) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-147) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.6e-147: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.6e-147) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.6e-147) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.6e-147], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.6 \cdot 10^{-147}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.60000000000000012e-147Initial program 88.2%
remove-double-neg88.2%
sin-neg88.2%
neg-mul-188.2%
*-commutative88.2%
associate-*l*88.2%
associate-*l/86.1%
associate-/r/86.1%
associate-*l/88.2%
associate-/r/88.1%
sin-neg88.1%
neg-mul-188.1%
associate-/r*88.1%
associate-/r/88.2%
Simplified99.6%
Taylor expanded in ky around 0 23.2%
Taylor expanded in kx around 0 13.1%
associate-/l*14.1%
Simplified14.1%
if 3.60000000000000012e-147 < ky Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.2%
associate-/r/99.2%
associate-*l/99.7%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.7%
Simplified99.8%
Taylor expanded in kx around 0 42.6%
Final simplification25.0%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 92.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/91.1%
associate-/r/91.1%
associate-*l/92.6%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.6%
Simplified99.7%
Taylor expanded in kx around 0 27.5%
Final simplification27.5%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))))
double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
def code(kx, ky, th): return 1.0 / ((1.0 / th) + (th * 0.16666666666666666))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}
\end{array}
Initial program 92.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/91.1%
associate-/r/91.1%
associate-*l/92.6%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.6%
Simplified99.7%
associate-*l/96.5%
clear-num96.4%
hypot-udef90.9%
unpow290.9%
unpow290.9%
+-commutative90.9%
unpow290.9%
unpow290.9%
hypot-def96.4%
Applied egg-rr96.4%
Taylor expanded in kx around 0 27.4%
Taylor expanded in th around 0 14.6%
Final simplification14.6%
(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.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/91.1%
associate-/r/91.1%
associate-*l/92.6%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.6%
Simplified99.7%
associate-*l/96.5%
clear-num96.4%
hypot-udef90.9%
unpow290.9%
unpow290.9%
+-commutative90.9%
unpow290.9%
unpow290.9%
hypot-def96.4%
Applied egg-rr96.4%
Taylor expanded in kx around 0 27.4%
Taylor expanded in th around 0 14.0%
Final simplification14.0%
herbie shell --seed 2024019
(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)))