
(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 23 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 ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/89.0%
associate-/l*92.0%
unpow292.0%
Simplified99.5%
associate-*r/92.9%
hypot-undefine89.0%
unpow289.0%
unpow289.0%
+-commutative89.0%
associate-*l/92.0%
*-commutative92.0%
clear-num92.0%
un-div-inv92.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin kx) 2e-116)
(sin th)
(if (<= (sin kx) 5e-7)
(/ (sin ky) (/ (hypot (sin ky) kx) th))
(* (sin th) (/ (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-116) {
tmp = sin(th);
} else if (sin(kx) <= 5e-7) {
tmp = sin(ky) / (hypot(sin(ky), kx) / th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-116) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-7) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / 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.01: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-116: tmp = math.sin(th) elif math.sin(kx) <= 5e-7: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / 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.01) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-116) tmp = sin(th); elseif (sin(kx) <= 5e-7) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / 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.01) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-116) tmp = sin(th); elseif (sin(kx) <= 5e-7) tmp = sin(ky) / (hypot(sin(ky), kx) / 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.01], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-116], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-7], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $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.01:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-116}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
Taylor expanded in ky around 0 17.3%
add-sqr-sqrt14.8%
sqrt-unprod26.9%
pow226.9%
*-commutative26.9%
clear-num26.9%
un-div-inv26.9%
Applied egg-rr26.9%
unpow226.9%
rem-sqrt-square31.8%
associate-/r/31.8%
/-rgt-identity31.8%
times-frac31.8%
*-commutative31.8%
*-rgt-identity31.8%
associate-/l*31.8%
Simplified31.8%
if -0.0100000000000000002 < (sin.f64 kx) < 2e-116Initial program 80.6%
unpow280.6%
sqr-neg80.6%
sin-neg80.6%
sin-neg80.6%
unpow280.6%
associate-*l/73.9%
associate-/l*80.5%
unpow280.5%
Simplified99.7%
Taylor expanded in kx around 0 35.0%
if 2e-116 < (sin.f64 kx) < 4.99999999999999977e-7Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/96.3%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
clear-num99.5%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in kx around 0 99.9%
Taylor expanded in th around 0 66.5%
associate-*l/66.8%
+-commutative66.8%
unpow266.8%
unpow266.8%
hypot-undefine66.8%
*-lft-identity66.8%
Simplified66.8%
if 4.99999999999999977e-7 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 66.6%
Final simplification44.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* th (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (* ky 2.0)))))))
(if (<= (sin ky) 1e-190)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 2e-40)
(/ (sin ky) (/ (hypot ky kx) (sin th)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = th * (sin(ky) / sqrt((0.5 - (0.5 * cos((ky * 2.0))))));
} else if (sin(ky) <= 1e-190) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 2e-40) {
tmp = sin(ky) / (hypot(ky, kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = th * (Math.sin(ky) / Math.sqrt((0.5 - (0.5 * Math.cos((ky * 2.0))))));
} else if (Math.sin(ky) <= 1e-190) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-40) {
tmp = Math.sin(ky) / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = th * (math.sin(ky) / math.sqrt((0.5 - (0.5 * math.cos((ky * 2.0)))))) elif math.sin(ky) <= 1e-190: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 2e-40: tmp = math.sin(ky) / (math.hypot(ky, kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th * Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(ky * 2.0))))))); elseif (sin(ky) <= 1e-190) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 2e-40) tmp = Float64(sin(ky) / Float64(hypot(ky, 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.01) tmp = th * (sin(ky) / sqrt((0.5 - (0.5 * cos((ky * 2.0)))))); elseif (sin(ky) <= 1e-190) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 2e-40) tmp = sin(ky) / (hypot(ky, kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(ky * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-190], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-40], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;th \cdot \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky \cdot 2\right)}}\\
\mathbf{elif}\;\sin ky \leq 10^{-190}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
+-inverses99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in kx around 0 59.9%
Taylor expanded in th around 0 37.3%
if -0.0100000000000000002 < (sin.f64 ky) < 1e-190Initial program 81.0%
Taylor expanded in ky around 0 42.9%
if 1e-190 < (sin.f64 ky) < 1.9999999999999999e-40Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/87.8%
associate-/l*93.6%
unpow293.6%
Simplified99.6%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 70.5%
Taylor expanded in ky around 0 70.5%
if 1.9999999999999999e-40 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 60.5%
Final simplification49.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(/ (sin ky) (/ (hypot (sin ky) kx) th))
(if (<= (sin ky) 1e-190)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 2e-40)
(/ (sin ky) (/ (hypot ky kx) (sin th)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) / (hypot(sin(ky), kx) / th);
} else if (sin(ky) <= 1e-190) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 2e-40) {
tmp = sin(ky) / (hypot(ky, kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / th);
} else if (Math.sin(ky) <= 1e-190) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-40) {
tmp = Math.sin(ky) / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / th) elif math.sin(ky) <= 1e-190: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 2e-40: tmp = math.sin(ky) / (math.hypot(ky, kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / th)); elseif (sin(ky) <= 1e-190) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 2e-40) tmp = Float64(sin(ky) / Float64(hypot(ky, 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.01) tmp = sin(ky) / (hypot(sin(ky), kx) / th); elseif (sin(ky) <= 1e-190) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 2e-40) tmp = sin(ky) / (hypot(ky, kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-190], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-40], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-190}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 54.1%
Taylor expanded in th around 0 33.0%
associate-*l/33.2%
+-commutative33.2%
unpow233.2%
unpow233.2%
hypot-undefine33.3%
*-lft-identity33.3%
Simplified33.3%
if -0.0100000000000000002 < (sin.f64 ky) < 1e-190Initial program 81.0%
Taylor expanded in ky around 0 42.9%
if 1e-190 < (sin.f64 ky) < 1.9999999999999999e-40Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/87.8%
associate-/l*93.6%
unpow293.6%
Simplified99.6%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 70.5%
Taylor expanded in ky around 0 70.5%
if 1.9999999999999999e-40 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 60.5%
Final simplification48.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* th (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (* ky 2.0)))))))
(if (<= (sin ky) 5e-17)
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = th * (sin(ky) / sqrt((0.5 - (0.5 * cos((ky * 2.0))))));
} else if (sin(ky) <= 5e-17) {
tmp = sin(th) * (sin(ky) / fabs(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.01d0)) then
tmp = th * (sin(ky) / sqrt((0.5d0 - (0.5d0 * cos((ky * 2.0d0))))))
else if (sin(ky) <= 5d-17) then
tmp = sin(th) * (sin(ky) / abs(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.01) {
tmp = th * (Math.sin(ky) / Math.sqrt((0.5 - (0.5 * Math.cos((ky * 2.0))))));
} else if (Math.sin(ky) <= 5e-17) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = th * (math.sin(ky) / math.sqrt((0.5 - (0.5 * math.cos((ky * 2.0)))))) elif math.sin(ky) <= 5e-17: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th * Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(ky * 2.0))))))); elseif (sin(ky) <= 5e-17) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = th * (sin(ky) / sqrt((0.5 - (0.5 * cos((ky * 2.0)))))); elseif (sin(ky) <= 5e-17) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(ky * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-17], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;th \cdot \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky \cdot 2\right)}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
+-inverses99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in kx around 0 59.9%
Taylor expanded in th around 0 37.3%
if -0.0100000000000000002 < (sin.f64 ky) < 4.9999999999999999e-17Initial program 84.8%
Taylor expanded in ky around 0 44.7%
add-sqr-sqrt35.6%
sqrt-prod68.5%
rem-sqrt-square74.9%
Applied egg-rr74.9%
if 4.9999999999999999e-17 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.8%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 63.2%
Final simplification62.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-190) (* (sin th) (/ (sin ky) (sin kx))) (if (<= (sin ky) 2e-40) (/ (sin ky) (/ (hypot ky kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-190) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 2e-40) {
tmp = sin(ky) / (hypot(ky, kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-190) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-40) {
tmp = Math.sin(ky) / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-190: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 2e-40: tmp = math.sin(ky) / (math.hypot(ky, kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-190) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 2e-40) tmp = Float64(sin(ky) / Float64(hypot(ky, kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-190) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 2e-40) tmp = sin(ky) / (hypot(ky, kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-190], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-40], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-190}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-40}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-190Initial program 88.4%
Taylor expanded in ky around 0 28.7%
if 1e-190 < (sin.f64 ky) < 1.9999999999999999e-40Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/87.8%
associate-/l*93.6%
unpow293.6%
Simplified99.6%
clear-num99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 70.5%
Taylor expanded in ky around 0 70.5%
if 1.9999999999999999e-40 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 60.5%
Final simplification42.3%
(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.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/89.0%
associate-/l*92.0%
unpow292.0%
Simplified99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0275)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 8.8e+45)
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(* (sin th) (/ (sin ky) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0275) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 8.8e+45) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0275) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 8.8e+45) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0275: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 8.8e+45: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0275) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 8.8e+45) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0275) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 8.8e+45) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(th) * (sin(ky) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0275], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 8.8e+45], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0275:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 8.8 \cdot 10^{+45}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if th < 0.0275000000000000001Initial program 92.1%
unpow292.1%
sqr-neg92.1%
sin-neg92.1%
sin-neg92.1%
unpow292.1%
associate-*l/88.2%
associate-/l*92.1%
unpow292.1%
Simplified99.6%
Taylor expanded in th around 0 73.2%
if 0.0275000000000000001 < th < 8.8000000000000001e45Initial program 99.4%
Taylor expanded in ky around 0 40.0%
add-sqr-sqrt38.8%
sqrt-prod59.1%
rem-sqrt-square59.1%
Applied egg-rr59.1%
if 8.8000000000000001e45 < th Initial program 90.3%
unpow290.3%
sin-mult82.7%
Applied egg-rr82.7%
div-sub82.7%
+-inverses82.7%
+-inverses82.7%
+-inverses82.7%
cos-082.7%
metadata-eval82.7%
count-282.7%
*-commutative82.7%
Simplified82.7%
Taylor expanded in kx around 0 34.1%
sqr-sin-a41.5%
rem-sqrt-square49.4%
Applied egg-rr49.4%
Final simplification67.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (+ (+ (fabs (sin th)) 1.0) -1.0) (if (<= (sin ky) 1e-60) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = (fabs(sin(th)) + 1.0) + -1.0;
} else if (sin(ky) <= 1e-60) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = (abs(sin(th)) + 1.0d0) + (-1.0d0)
else if (sin(ky) <= 1d-60) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = (Math.abs(Math.sin(th)) + 1.0) + -1.0;
} else if (Math.sin(ky) <= 1e-60) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = (math.fabs(math.sin(th)) + 1.0) + -1.0 elif math.sin(ky) <= 1e-60: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(Float64(abs(sin(th)) + 1.0) + -1.0); elseif (sin(ky) <= 1e-60) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = (abs(sin(th)) + 1.0) + -1.0; elseif (sin(ky) <= 1e-60) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[(N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-60], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left(\left|\sin th\right| + 1\right) + -1\\
\mathbf{elif}\;\sin ky \leq 10^{-60}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
expm1-log1p-u2.9%
expm1-undefine3.8%
Applied egg-rr3.8%
expm1-define2.9%
Simplified2.9%
expm1-undefine3.8%
log1p-undefine3.8%
rem-exp-log3.8%
+-commutative3.8%
Applied egg-rr3.8%
add-sqr-sqrt2.0%
sqrt-unprod14.2%
pow214.2%
Applied egg-rr14.2%
unpow214.2%
rem-sqrt-square14.2%
Simplified14.2%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999997e-61Initial program 84.1%
Taylor expanded in ky around 0 43.9%
if 9.9999999999999997e-61 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 59.6%
Final simplification41.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 1e-60) (* (sin th) (/ ky (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) <= 1e-60) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-60) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-60) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-60: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-60) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-60) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-60], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-60}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt2.0%
sqrt-unprod14.2%
pow214.2%
Applied egg-rr20.5%
unpow214.2%
rem-sqrt-square14.2%
Simplified27.4%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999997e-61Initial program 84.1%
Taylor expanded in ky around 0 43.9%
if 9.9999999999999997e-61 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 59.6%
Final simplification44.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.051) (/ (sin th) (/ (hypot (sin ky) kx) (sin ky))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.051) {
tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.051) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.051: tmp = math.sin(th) / (math.hypot(math.sin(ky), kx) / math.sin(ky)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.051) tmp = Float64(sin(th) / Float64(hypot(sin(ky), kx) / sin(ky))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.051) tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.051], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.051:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.0509999999999999967Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/85.5%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
associate-*r/90.7%
hypot-undefine85.5%
unpow285.5%
unpow285.5%
+-commutative85.5%
associate-*l/89.5%
*-commutative89.5%
clear-num89.4%
un-div-inv89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 71.4%
if 0.0509999999999999967 < kx Initial program 99.5%
Taylor expanded in ky around 0 43.0%
add-sqr-sqrt30.6%
sqrt-prod68.1%
rem-sqrt-square68.1%
Applied egg-rr68.1%
Final simplification70.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.054) (/ (sin ky) (/ (hypot (sin ky) kx) (sin th))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.054) {
tmp = sin(ky) / (hypot(sin(ky), kx) / sin(th));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.054) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / Math.sin(th));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.054: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / math.sin(th)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.054) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / sin(th))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.054) tmp = sin(ky) / (hypot(sin(ky), kx) / sin(th)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.054], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.054:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.0539999999999999994Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/85.5%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 71.3%
if 0.0539999999999999994 < kx Initial program 99.5%
Taylor expanded in ky around 0 43.0%
add-sqr-sqrt30.6%
sqrt-prod68.1%
rem-sqrt-square68.1%
Applied egg-rr68.1%
Final simplification70.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.065) (* (sin ky) (/ (sin th) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.065) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.065) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.065: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.065) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.065) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.065], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.065:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.065000000000000002Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/85.5%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
Taylor expanded in kx around 0 71.3%
if 0.065000000000000002 < kx Initial program 99.5%
Taylor expanded in ky around 0 43.0%
add-sqr-sqrt30.6%
sqrt-prod68.1%
rem-sqrt-square68.1%
Applied egg-rr68.1%
Final simplification70.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.6e-13) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin th) (/ (sin ky) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-13) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-13) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.6e-13: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.6e-13) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.6e-13) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th) * (sin(ky) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.6e-13], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.6 \cdot 10^{-13}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2.6e-13Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/85.9%
associate-/l*89.7%
unpow289.7%
Simplified99.5%
Taylor expanded in ky around 0 69.2%
if 2.6e-13 < ky Initial program 99.7%
unpow299.7%
sin-mult98.9%
Applied egg-rr98.9%
div-sub98.9%
+-inverses98.9%
+-inverses98.9%
+-inverses98.9%
cos-098.9%
metadata-eval98.9%
count-298.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in kx around 0 64.8%
sqr-sin-a65.4%
rem-sqrt-square65.4%
Applied egg-rr65.4%
Final simplification68.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.051) (* (sin th) (/ (sin ky) (fabs (sin ky)))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.051) {
tmp = sin(th) * (sin(ky) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / fabs(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 <= 0.051d0) then
tmp = sin(th) * (sin(ky) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / abs(sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.051) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.051: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.051) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.051) tmp = sin(th) * (sin(ky) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.051], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.051:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.0509999999999999967Initial program 89.5%
unpow289.5%
sin-mult77.5%
Applied egg-rr77.5%
div-sub77.5%
+-inverses77.5%
+-inverses77.5%
+-inverses77.5%
cos-077.5%
metadata-eval77.5%
count-277.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in kx around 0 37.8%
sqr-sin-a50.1%
rem-sqrt-square56.7%
Applied egg-rr56.7%
if 0.0509999999999999967 < kx Initial program 99.5%
Taylor expanded in ky around 0 43.0%
add-sqr-sqrt30.6%
sqrt-prod68.1%
rem-sqrt-square68.1%
Applied egg-rr68.1%
Final simplification59.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-60) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-60) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-60) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-60) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-60: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-60) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-60) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-60], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-60}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.9999999999999997e-61Initial program 89.2%
Taylor expanded in ky around 0 32.0%
if 9.9999999999999997e-61 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 59.6%
Final simplification39.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-60) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-60) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-60) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-60) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-60: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-60) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-60) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-60], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-60}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.9999999999999997e-61Initial program 89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
associate-*l/85.0%
associate-/l*89.1%
unpow289.1%
Simplified99.5%
Taylor expanded in ky around 0 32.1%
if 9.9999999999999997e-61 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 59.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-60) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-60) {
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) <= 1d-60) 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) <= 1e-60) {
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) <= 1e-60: 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) <= 1e-60) 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) <= 1e-60) 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], 1e-60], 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 10^{-60}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.9999999999999997e-61Initial program 89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
associate-*l/85.0%
associate-/l*89.1%
unpow289.1%
Simplified99.5%
Taylor expanded in ky around 0 29.2%
associate-/l*30.6%
Simplified30.6%
if 9.9999999999999997e-61 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 59.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.4e-189) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.4e-189) {
tmp = ky * (sin(th) / 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 <= 5.4d-189) then
tmp = ky * (sin(th) / 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 <= 5.4e-189) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.4e-189: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.4e-189) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5.4e-189) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.4e-189], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.4 \cdot 10^{-189}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.3999999999999999e-189Initial program 88.5%
unpow288.5%
sqr-neg88.5%
sin-neg88.5%
sin-neg88.5%
unpow288.5%
associate-*l/84.9%
associate-/l*88.5%
unpow288.5%
Simplified99.5%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 56.0%
Taylor expanded in ky around 0 13.8%
associate-/l*15.3%
Simplified15.3%
if 5.3999999999999999e-189 < ky Initial program 97.7%
unpow297.7%
sqr-neg97.7%
sin-neg97.7%
sin-neg97.7%
unpow297.7%
associate-*l/95.7%
associate-/l*97.6%
unpow297.6%
Simplified99.6%
Taylor expanded in kx around 0 32.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 230000.0) (sin th) (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 230000.0) {
tmp = sin(th);
} else {
tmp = (th + 1.0) + -1.0;
}
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 <= 230000.0d0) then
tmp = sin(th)
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 230000.0) {
tmp = Math.sin(th);
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 230000.0: tmp = math.sin(th) else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 230000.0) tmp = sin(th); else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 230000.0) tmp = sin(th); else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 230000.0], N[Sin[th], $MachinePrecision], N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 230000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 2.3e5Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/85.5%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
Taylor expanded in kx around 0 27.5%
if 2.3e5 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in kx around 0 7.4%
expm1-log1p-u7.4%
expm1-undefine18.9%
Applied egg-rr18.9%
expm1-define7.4%
Simplified7.4%
expm1-undefine18.9%
log1p-undefine18.9%
rem-exp-log18.9%
+-commutative18.9%
Applied egg-rr18.9%
Taylor expanded in th around 0 17.4%
+-commutative17.4%
Simplified17.4%
Final simplification25.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.7e-51) th (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-51) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.0;
}
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.7d-51) then
tmp = th
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-51) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.7e-51: tmp = th else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.7e-51) tmp = th; else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.7e-51) tmp = th; else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.7e-51], th, N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.7 \cdot 10^{-51}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 4.6999999999999997e-51Initial program 89.0%
unpow289.0%
sqr-neg89.0%
sin-neg89.0%
sin-neg89.0%
unpow289.0%
associate-*l/84.9%
associate-/l*89.0%
unpow289.0%
Simplified99.6%
Taylor expanded in kx around 0 26.4%
Taylor expanded in th around 0 15.8%
if 4.6999999999999997e-51 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in kx around 0 12.4%
expm1-log1p-u12.4%
expm1-undefine21.2%
Applied egg-rr21.2%
expm1-define12.4%
Simplified12.4%
expm1-undefine21.2%
log1p-undefine21.2%
rem-exp-log21.2%
+-commutative21.2%
Applied egg-rr21.2%
Taylor expanded in th around 0 17.3%
+-commutative17.3%
Simplified17.3%
Final simplification16.3%
(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.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/89.0%
associate-/l*92.0%
unpow292.0%
Simplified99.5%
Taylor expanded in kx around 0 22.4%
Taylor expanded in th around 0 13.7%
herbie shell --seed 2024130
(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)))