
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin 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 94.8%
remove-double-neg94.8%
sin-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-*l*94.8%
associate-*l/93.3%
associate-/r/93.3%
associate-*l/94.8%
associate-/r/94.7%
sin-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
associate-/r/94.8%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef94.8%
unpow294.8%
unpow294.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-7)
(/ (* (sin th) ky) (hypot (sin kx) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-7) {
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.005) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-7) {
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.005: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-7: 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.005) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-7) tmp = Float64(Float64(sin(th) * 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.005) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-7) 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.005], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-7], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.7%
associate-/r/99.7%
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 th around 0 40.4%
add-log-exp4.3%
associate-*l*4.3%
exp-prod4.3%
sqrt-div4.3%
metadata-eval4.3%
+-commutative4.3%
unpow24.3%
unpow24.3%
hypot-udef4.3%
div-inv4.3%
hypot-udef4.3%
Applied egg-rr4.3%
log-pow4.3%
hypot-def4.3%
unpow24.3%
unpow24.3%
+-commutative4.3%
unpow24.3%
unpow24.3%
hypot-def4.3%
rem-log-exp40.5%
Simplified40.5%
if -0.0050000000000000001 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 89.1%
remove-double-neg89.1%
sin-neg89.1%
neg-mul-189.1%
*-commutative89.1%
associate-*l*89.1%
associate-*l/86.0%
associate-/r/86.0%
associate-*l/89.1%
associate-/r/89.1%
sin-neg89.1%
neg-mul-189.1%
associate-/r*89.1%
associate-/r/89.1%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.7%
hypot-udef89.1%
unpow289.1%
unpow289.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-def99.7%
Applied egg-rr99.7%
associate-/r/99.7%
Applied egg-rr99.7%
associate-*l/93.5%
Applied egg-rr93.5%
Taylor expanded in ky around 0 93.4%
if 1.9999999999999999e-7 < (sin.f64 ky) Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 64.6%
Final simplification71.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(/
(sin ky)
(* (hypot (sin ky) (sin kx)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 2e-7)
(/ (* (sin th) ky) (hypot (sin kx) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 2e-7) {
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.005) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 2e-7) {
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.005: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 2e-7: 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.005) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 2e-7) tmp = Float64(Float64(sin(th) * 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.005) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 2e-7) 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.005], 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], 2e-7], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\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 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.7%
associate-/r/99.7%
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%
expm1-log1p-u99.5%
expm1-udef63.4%
hypot-udef63.4%
unpow263.4%
unpow263.4%
+-commutative63.4%
unpow263.4%
unpow263.4%
hypot-def63.4%
Applied egg-rr63.4%
expm1-def99.5%
expm1-log1p99.7%
associate-/r/99.6%
hypot-def99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 40.9%
+-commutative40.9%
unpow240.9%
unpow240.9%
hypot-def40.9%
associate-*r*40.9%
unpow240.9%
unpow240.9%
hypot-def40.9%
distribute-rgt-out40.9%
Simplified40.9%
if -0.0050000000000000001 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 89.1%
remove-double-neg89.1%
sin-neg89.1%
neg-mul-189.1%
*-commutative89.1%
associate-*l*89.1%
associate-*l/86.0%
associate-/r/86.0%
associate-*l/89.1%
associate-/r/89.1%
sin-neg89.1%
neg-mul-189.1%
associate-/r*89.1%
associate-/r/89.1%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.7%
hypot-udef89.1%
unpow289.1%
unpow289.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-def99.7%
Applied egg-rr99.7%
associate-/r/99.7%
Applied egg-rr99.7%
associate-*l/93.5%
Applied egg-rr93.5%
Taylor expanded in ky around 0 93.4%
if 1.9999999999999999e-7 < (sin.f64 ky) Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 64.6%
Final simplification71.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-78) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-78) {
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.02d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-78) 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.02) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-78) {
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.02: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-78: 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.02) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-78) 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.02) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-78) 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.02], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-78], 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.02:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-78}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in ky around 0 17.2%
add-sqr-sqrt15.6%
sqrt-unprod30.9%
pow230.9%
associate-/l*31.0%
associate-/r/30.9%
Applied egg-rr30.9%
unpow230.9%
rem-sqrt-square36.2%
associate-*l/36.3%
associate-*r/36.2%
Simplified36.2%
if -0.0200000000000000004 < (sin.f64 kx) < 9.99999999999999999e-79Initial program 88.6%
remove-double-neg88.6%
sin-neg88.6%
neg-mul-188.6%
*-commutative88.6%
associate-*l*88.6%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/88.6%
associate-/r/88.4%
sin-neg88.4%
neg-mul-188.4%
associate-/r*88.4%
associate-/r/88.6%
Simplified99.9%
Taylor expanded in kx around 0 48.2%
if 9.99999999999999999e-79 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 57.2%
Final simplification48.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(fabs (* ky t_1))
(if (<= (sin kx) 1e-78) (sin th) (* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 1e-78) {
tmp = sin(th);
} else {
tmp = sin(ky) * t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(th) / sin(kx)
if (sin(kx) <= (-0.02d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 1d-78) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 1e-78) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 1e-78: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 1e-78) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((ky * t_1)); elseif (sin(kx) <= 1e-78) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-78], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|ky \cdot t_1\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-78}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in ky around 0 17.2%
add-sqr-sqrt15.6%
sqrt-unprod30.9%
pow230.9%
associate-/l*31.0%
associate-/r/30.9%
Applied egg-rr30.9%
unpow230.9%
rem-sqrt-square36.2%
associate-*l/36.3%
associate-*r/36.2%
Simplified36.2%
if -0.0200000000000000004 < (sin.f64 kx) < 9.99999999999999999e-79Initial program 88.6%
remove-double-neg88.6%
sin-neg88.6%
neg-mul-188.6%
*-commutative88.6%
associate-*l*88.6%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/88.6%
associate-/r/88.4%
sin-neg88.4%
neg-mul-188.4%
associate-/r*88.4%
associate-/r/88.6%
Simplified99.9%
Taylor expanded in kx around 0 48.2%
if 9.99999999999999999e-79 < (sin.f64 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.6%
associate-/r/99.6%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
hypot-udef99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Applied egg-rr99.6%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 57.3%
Final simplification48.9%
(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 94.8%
remove-double-neg94.8%
sin-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-*l*94.8%
associate-*l/93.3%
associate-/r/93.3%
associate-*l/94.8%
associate-/r/94.7%
sin-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
associate-/r/94.8%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-78) (sin th) (/ ky (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-78) {
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.02d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-78) 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.02) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-78) {
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.02: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-78: 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.02) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-78) 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.02) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-78) 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.02], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-78], 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.02:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-78}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in ky around 0 17.2%
add-sqr-sqrt15.6%
sqrt-unprod30.9%
pow230.9%
associate-/l*31.0%
associate-/r/30.9%
Applied egg-rr30.9%
unpow230.9%
rem-sqrt-square36.2%
associate-*l/36.3%
associate-*r/36.2%
Simplified36.2%
if -0.0200000000000000004 < (sin.f64 kx) < 9.99999999999999999e-79Initial program 88.6%
remove-double-neg88.6%
sin-neg88.6%
neg-mul-188.6%
*-commutative88.6%
associate-*l*88.6%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/88.6%
associate-/r/88.4%
sin-neg88.4%
neg-mul-188.4%
associate-/r*88.4%
associate-/r/88.6%
Simplified99.9%
Taylor expanded in kx around 0 48.2%
if 9.99999999999999999e-79 < (sin.f64 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.6%
associate-/r/99.6%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.6%
Taylor expanded in ky around 0 49.0%
associate-/l*49.1%
Simplified49.1%
Final simplification46.0%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0135) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0135) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0135) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0135: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0135) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0135) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0135], N[(N[Sin[ky], $MachinePrecision] * N[(th / 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}\;th \leq 0.0135:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.0134999999999999998Initial program 95.2%
remove-double-neg95.2%
sin-neg95.2%
neg-mul-195.2%
*-commutative95.2%
associate-*l*95.2%
associate-*l/93.3%
associate-/r/93.3%
associate-*l/95.2%
associate-/r/95.1%
sin-neg95.1%
neg-mul-195.1%
associate-/r*95.1%
associate-/r/95.2%
Simplified99.7%
Taylor expanded in th around 0 64.1%
expm1-log1p-u63.8%
expm1-udef17.5%
Applied egg-rr18.6%
expm1-def65.7%
expm1-log1p66.0%
*-commutative66.0%
*-lft-identity66.0%
times-frac69.8%
/-rgt-identity69.8%
hypot-def66.4%
unpow266.4%
unpow266.4%
+-commutative66.4%
unpow266.4%
unpow266.4%
hypot-def69.8%
Simplified69.8%
if 0.0134999999999999998 < th Initial program 93.6%
remove-double-neg93.6%
sin-neg93.6%
neg-mul-193.6%
*-commutative93.6%
associate-*l*93.6%
associate-*l/93.5%
associate-/r/93.5%
associate-*l/93.6%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.6%
Simplified99.7%
Taylor expanded in kx around 0 25.8%
Final simplification58.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.017) (* th (/ (sin ky) (hypot (sin ky) (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.017) {
tmp = th * (sin(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 (th <= 0.017) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.017: tmp = th * (math.sin(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 (th <= 0.017) tmp = Float64(th * Float64(sin(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 (th <= 0.017) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.017], N[(th * N[(N[Sin[ky], $MachinePrecision] / 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}\;th \leq 0.017:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.017000000000000001Initial program 95.2%
remove-double-neg95.2%
sin-neg95.2%
neg-mul-195.2%
*-commutative95.2%
associate-*l*95.2%
associate-*l/93.3%
associate-/r/93.3%
associate-*l/95.2%
associate-/r/95.1%
sin-neg95.1%
neg-mul-195.1%
associate-/r*95.1%
associate-/r/95.2%
Simplified99.7%
Taylor expanded in th around 0 64.1%
add-log-exp17.5%
associate-*l*17.6%
exp-prod18.1%
sqrt-div18.3%
metadata-eval18.3%
+-commutative18.3%
unpow218.3%
unpow218.3%
hypot-udef18.5%
div-inv18.5%
hypot-udef18.3%
Applied egg-rr18.5%
log-pow19.5%
hypot-def18.4%
unpow218.4%
unpow218.4%
+-commutative18.4%
unpow218.4%
unpow218.4%
hypot-def19.5%
rem-log-exp69.9%
Simplified69.9%
if 0.017000000000000001 < th Initial program 93.6%
remove-double-neg93.6%
sin-neg93.6%
neg-mul-193.6%
*-commutative93.6%
associate-*l*93.6%
associate-*l/93.5%
associate-/r/93.5%
associate-*l/93.6%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.6%
Simplified99.7%
Taylor expanded in kx around 0 25.8%
Final simplification58.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.9e-71) (sin th) (* ky (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.9e-71) {
tmp = sin(th);
} else {
tmp = ky * (sin(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 (kx <= 3.9d-71) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.9e-71) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.9e-71: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.9e-71) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.9e-71) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.9e-71], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.9 \cdot 10^{-71}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.9000000000000002e-71Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in kx around 0 33.9%
if 3.9000000000000002e-71 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
hypot-udef99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Applied egg-rr99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 40.7%
associate-*r/40.7%
Simplified40.7%
Final simplification36.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.95e-68) (sin th) (/ ky (/ (sin kx) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.95e-68) {
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 (kx <= 2.95d-68) 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 (kx <= 2.95e-68) {
tmp = Math.sin(th);
} else {
tmp = ky / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.95e-68: tmp = math.sin(th) else: tmp = ky / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.95e-68) 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 (kx <= 2.95e-68) tmp = sin(th); else tmp = ky / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.95e-68], 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}\;kx \leq 2.95 \cdot 10^{-68}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if kx < 2.95e-68Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in kx around 0 33.9%
if 2.95e-68 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.7%
associate-/l*40.8%
Simplified40.8%
Final simplification36.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.12e-86) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.12e-86) {
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 <= 1.12d-86) 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 <= 1.12e-86) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.12e-86: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.12e-86) 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 <= 1.12e-86) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.12e-86], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.12 \cdot 10^{-86}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.12e-86Initial program 92.3%
remove-double-neg92.3%
sin-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-*l*92.3%
associate-*l/90.6%
associate-/r/90.6%
associate-*l/92.3%
associate-/r/92.3%
sin-neg92.3%
neg-mul-192.3%
associate-/r*92.3%
associate-/r/92.3%
Simplified99.7%
Taylor expanded in ky around 0 34.5%
Taylor expanded in kx around 0 23.0%
associate-/l*23.0%
Simplified23.0%
associate-/r/22.9%
Applied egg-rr22.9%
if 1.12e-86 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/98.7%
associate-/r/98.7%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 38.1%
Final simplification28.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.85e-66) (sin th) (/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.85e-66) {
tmp = sin(th);
} else {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.85d-66) then
tmp = sin(th)
else
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.85e-66) {
tmp = Math.sin(th);
} else {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.85e-66: tmp = math.sin(th) else: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.85e-66) tmp = sin(th); else tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.85e-66) tmp = sin(th); else tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.85e-66], N[Sin[th], $MachinePrecision], N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.85 \cdot 10^{-66}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\end{array}
\end{array}
if kx < 1.8500000000000001e-66Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in kx around 0 33.9%
if 1.8500000000000001e-66 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.7%
Taylor expanded in kx around 0 25.8%
associate-/l*25.9%
Simplified25.9%
Taylor expanded in th around 0 23.7%
Final simplification30.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 8.5e-72) th (/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.5e-72) {
tmp = th;
} else {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 8.5d-72) then
tmp = th
else
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.5e-72) {
tmp = th;
} else {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 8.5e-72: tmp = th else: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 8.5e-72) tmp = th; else tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 8.5e-72) tmp = th; else tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 8.5e-72], th, N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 8.5 \cdot 10^{-72}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\end{array}
\end{array}
if kx < 8.50000000000000008e-72Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in th around 0 45.4%
Taylor expanded in kx around 0 20.8%
if 8.50000000000000008e-72 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.7%
Taylor expanded in kx around 0 25.8%
associate-/l*25.9%
Simplified25.9%
Taylor expanded in th around 0 23.7%
Final simplification21.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.1e-69) th (* th (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-69) {
tmp = th;
} else {
tmp = th * (ky / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 3.1d-69) then
tmp = th
else
tmp = th * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-69) {
tmp = th;
} else {
tmp = th * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.1e-69: tmp = th else: tmp = th * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.1e-69) tmp = th; else tmp = Float64(th * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.1e-69) tmp = th; else tmp = th * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.1e-69], th, N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.1 \cdot 10^{-69}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if kx < 3.0999999999999999e-69Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in th around 0 45.4%
Taylor expanded in kx around 0 20.8%
if 3.0999999999999999e-69 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.7%
Taylor expanded in kx around 0 25.8%
associate-/l*25.9%
Simplified25.9%
Taylor expanded in th around 0 23.4%
associate-/l*23.5%
Simplified23.5%
associate-/r/23.4%
Applied egg-rr23.4%
Final simplification21.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.1e-73) th (/ ky (/ kx th))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.1e-73) {
tmp = th;
} else {
tmp = ky / (kx / th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 4.1d-73) then
tmp = th
else
tmp = ky / (kx / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.1e-73) {
tmp = th;
} else {
tmp = ky / (kx / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.1e-73: tmp = th else: tmp = ky / (kx / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.1e-73) tmp = th; else tmp = Float64(ky / Float64(kx / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.1e-73) tmp = th; else tmp = ky / (kx / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.1e-73], th, N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.1 \cdot 10^{-73}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\end{array}
\end{array}
if kx < 4.10000000000000016e-73Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.4%
associate-/r/90.4%
associate-*l/92.5%
associate-/r/92.4%
sin-neg92.4%
neg-mul-192.4%
associate-/r*92.4%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in th around 0 45.4%
Taylor expanded in kx around 0 20.8%
if 4.10000000000000016e-73 < kx Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 40.7%
Taylor expanded in kx around 0 25.8%
associate-/l*25.9%
Simplified25.9%
Taylor expanded in th around 0 23.4%
associate-/l*23.5%
Simplified23.5%
Final simplification21.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 94.8%
remove-double-neg94.8%
sin-neg94.8%
neg-mul-194.8%
*-commutative94.8%
associate-*l*94.8%
associate-*l/93.3%
associate-/r/93.3%
associate-*l/94.8%
associate-/r/94.7%
sin-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
associate-/r/94.8%
Simplified99.7%
Taylor expanded in th around 0 48.6%
Taylor expanded in kx around 0 16.5%
Final simplification16.5%
herbie shell --seed 2024017
(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)))