
(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 19 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 90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
associate-*l/88.5%
associate-/l*90.8%
+-commutative90.8%
unpow290.8%
sin-neg90.8%
sin-neg90.8%
Simplified99.6%
associate-*r/95.1%
hypot-undefine88.5%
unpow288.5%
unpow288.5%
+-commutative88.5%
associate-*l/90.8%
*-commutative90.8%
clear-num90.7%
un-div-inv90.8%
+-commutative90.8%
unpow290.8%
unpow290.8%
hypot-undefine99.6%
Applied egg-rr99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.1)
(sqrt (pow (sin th) 2.0))
(if (<= t_1 2e-190)
(/ (sin th) (/ (sin kx) ky))
(if (<= t_1 0.002) (fabs (* (sin th) (/ ky (sin kx)))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (t_1 <= 2e-190) {
tmp = sin(th) / (sin(kx) / ky);
} else if (t_1 <= 0.002) {
tmp = fabs((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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.1d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (t_1 <= 2d-190) then
tmp = sin(th) / (sin(kx) / ky)
else if (t_1 <= 0.002d0) then
tmp = abs((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 t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (t_1 <= 2e-190) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (t_1 <= 0.002) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.1: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif t_1 <= 2e-190: tmp = math.sin(th) / (math.sin(kx) / ky) elif t_1 <= 0.002: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 2e-190) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (t_1 <= 0.002) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 2e-190) tmp = sin(th) / (sin(kx) / ky); elseif (t_1 <= 0.002) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.1], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-190], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.1:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-190}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.10000000000000001Initial program 83.6%
unpow283.6%
sqr-neg83.6%
sin-neg83.6%
sin-neg83.6%
unpow283.6%
associate-*l/82.2%
associate-/l*83.4%
+-commutative83.4%
unpow283.4%
sin-neg83.4%
sin-neg83.4%
Simplified99.5%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.7%
sqrt-unprod20.8%
pow220.8%
Applied egg-rr20.8%
if -0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-190Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/93.9%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.7%
associate-*r/93.9%
hypot-undefine93.9%
unpow293.9%
unpow293.9%
+-commutative93.9%
associate-*l/99.1%
*-commutative99.1%
clear-num99.0%
un-div-inv99.1%
+-commutative99.1%
unpow299.1%
unpow299.1%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.3%
if 2e-190 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in ky around 0 45.3%
clear-num45.3%
un-div-inv45.3%
Applied egg-rr45.3%
add-sqr-sqrt40.0%
sqrt-unprod47.0%
pow247.0%
div-inv47.0%
clear-num47.0%
Applied egg-rr47.0%
unpow247.0%
rem-sqrt-square59.8%
associate-*r/59.7%
associate-*l/59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in ky around 0 59.7%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.1)
(sqrt (pow (sin th) 2.0))
(if (<= t_1 2e-190)
(/ (sin th) (/ (sin kx) ky))
(if (<= t_1 0.002) (fabs (* ky (/ (sin th) (sin kx)))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (t_1 <= 2e-190) {
tmp = sin(th) / (sin(kx) / ky);
} else if (t_1 <= 0.002) {
tmp = fabs((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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.1d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (t_1 <= 2d-190) then
tmp = sin(th) / (sin(kx) / ky)
else if (t_1 <= 0.002d0) then
tmp = abs((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 t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (t_1 <= 2e-190) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (t_1 <= 0.002) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.1: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif t_1 <= 2e-190: tmp = math.sin(th) / (math.sin(kx) / ky) elif t_1 <= 0.002: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 2e-190) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (t_1 <= 0.002) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 2e-190) tmp = sin(th) / (sin(kx) / ky); elseif (t_1 <= 0.002) tmp = abs((ky * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.1], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e-190], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.1:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-190}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.10000000000000001Initial program 83.6%
unpow283.6%
sqr-neg83.6%
sin-neg83.6%
sin-neg83.6%
unpow283.6%
associate-*l/82.2%
associate-/l*83.4%
+-commutative83.4%
unpow283.4%
sin-neg83.4%
sin-neg83.4%
Simplified99.5%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.7%
sqrt-unprod20.8%
pow220.8%
Applied egg-rr20.8%
if -0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-190Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/93.9%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.7%
associate-*r/93.9%
hypot-undefine93.9%
unpow293.9%
unpow293.9%
+-commutative93.9%
associate-*l/99.1%
*-commutative99.1%
clear-num99.0%
un-div-inv99.1%
+-commutative99.1%
unpow299.1%
unpow299.1%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.3%
if 2e-190 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 45.3%
add-sqr-sqrt40.0%
sqrt-unprod46.9%
pow246.9%
div-inv46.9%
clear-num46.9%
Applied egg-rr46.9%
unpow246.9%
rem-sqrt-square59.7%
associate-*r/59.6%
associate-*l/59.8%
*-commutative59.8%
Simplified59.8%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(sqrt (pow (sin th) 2.0))
(if (<= t_1 0.002) (/ (sin th) (/ (fabs (sin kx)) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (t_1 <= 0.002) {
tmp = sin(th) / (fabs(sin(kx)) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.05d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (t_1 <= 0.002d0) then
tmp = sin(th) / (abs(sin(kx)) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (t_1 <= 0.002) {
tmp = Math.sin(th) / (Math.abs(Math.sin(kx)) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.05: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif t_1 <= 0.002: tmp = math.sin(th) / (math.fabs(math.sin(kx)) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 0.002) tmp = Float64(sin(th) / Float64(abs(sin(kx)) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.05) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 0.002) tmp = sin(th) / (abs(sin(kx)) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.05], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[(N[Sin[th], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\frac{\sin th}{\frac{\left|\sin kx\right|}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 83.6%
unpow283.6%
sqr-neg83.6%
sin-neg83.6%
sin-neg83.6%
unpow283.6%
associate-*l/82.2%
associate-/l*83.4%
+-commutative83.4%
unpow283.4%
sin-neg83.4%
sin-neg83.4%
Simplified99.5%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.7%
sqrt-unprod20.8%
pow220.8%
Applied egg-rr20.8%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/95.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.7%
associate-*r/95.4%
hypot-undefine95.4%
unpow295.4%
unpow295.4%
+-commutative95.4%
associate-*l/99.2%
*-commutative99.2%
clear-num99.1%
un-div-inv99.2%
+-commutative99.2%
unpow299.2%
unpow299.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 54.7%
add-sqr-sqrt41.1%
sqrt-unprod97.7%
pow297.7%
Applied egg-rr97.7%
unpow297.7%
rem-sqrt-square98.0%
Simplified98.0%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 2e-190)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= t_1 0.002) (fabs (* (sin th) (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-190) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (t_1 <= 0.002) {
tmp = fabs((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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= 2d-190) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (t_1 <= 0.002d0) then
tmp = abs((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 t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-190) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (t_1 <= 0.002) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= 2e-190: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif t_1 <= 0.002: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 2e-190) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (t_1 <= 0.002) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= 2e-190) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (t_1 <= 0.002) tmp = abs((sin(th) * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 2e-190], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-190}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-190Initial program 91.0%
unpow291.0%
sqr-neg91.0%
sin-neg91.0%
sin-neg91.0%
unpow291.0%
associate-*l/87.8%
associate-/l*91.0%
+-commutative91.0%
unpow291.0%
sin-neg91.0%
sin-neg91.0%
Simplified99.6%
Taylor expanded in ky around 0 33.2%
if 2e-190 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in ky around 0 45.3%
clear-num45.3%
un-div-inv45.3%
Applied egg-rr45.3%
add-sqr-sqrt40.0%
sqrt-unprod47.0%
pow247.0%
div-inv47.0%
clear-num47.0%
Applied egg-rr47.0%
unpow247.0%
rem-sqrt-square59.8%
associate-*r/59.7%
associate-*l/59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in ky around 0 59.7%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.1)
(sqrt (pow (sin th) 2.0))
(if (<= t_1 0.002) (/ (sin th) (/ (sin kx) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (t_1 <= 0.002) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.1d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (t_1 <= 0.002d0) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.1) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (t_1 <= 0.002) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.1: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif t_1 <= 0.002: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 0.002) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.1) tmp = sqrt((sin(th) ^ 2.0)); elseif (t_1 <= 0.002) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.1], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.1:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.10000000000000001Initial program 83.6%
unpow283.6%
sqr-neg83.6%
sin-neg83.6%
sin-neg83.6%
unpow283.6%
associate-*l/82.2%
associate-/l*83.4%
+-commutative83.4%
unpow283.4%
sin-neg83.4%
sin-neg83.4%
Simplified99.5%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.7%
sqrt-unprod20.8%
pow220.8%
Applied egg-rr20.8%
if -0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/95.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.7%
associate-*r/95.4%
hypot-undefine95.4%
unpow295.4%
unpow295.4%
+-commutative95.4%
associate-*l/99.2%
*-commutative99.2%
clear-num99.1%
un-div-inv99.2%
+-commutative99.2%
unpow299.2%
unpow299.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 54.7%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(fabs (sin th))
(if (<= t_1 0.002) (fabs (* th (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = fabs(sin(th));
} else if (t_1 <= 0.002) {
tmp = fabs((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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.05d0)) then
tmp = abs(sin(th))
else if (t_1 <= 0.002d0) then
tmp = abs((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 t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (t_1 <= 0.002) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.05: tmp = math.fabs(math.sin(th)) elif t_1 <= 0.002: tmp = math.fabs((th * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = abs(sin(th)); elseif (t_1 <= 0.002) tmp = abs(Float64(th * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.05) tmp = abs(sin(th)); elseif (t_1 <= 0.002) tmp = abs((th * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 0.002], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;t\_1 \leq 0.002:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 83.6%
unpow283.6%
sqr-neg83.6%
sin-neg83.6%
sin-neg83.6%
unpow283.6%
associate-*l/82.2%
associate-/l*83.4%
+-commutative83.4%
unpow283.4%
sin-neg83.4%
sin-neg83.4%
Simplified99.5%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.7%
pow21.7%
Applied egg-rr1.7%
unpow21.7%
fabs-sqr1.7%
add-sqr-sqrt29.8%
Applied egg-rr29.8%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/95.4%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.7%
associate-*r/95.4%
hypot-undefine95.4%
unpow295.4%
unpow295.4%
+-commutative95.4%
associate-*l/99.2%
*-commutative99.2%
clear-num99.1%
un-div-inv99.2%
+-commutative99.2%
unpow299.2%
unpow299.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 50.6%
Taylor expanded in ky around 0 31.3%
associate-/l*34.2%
Simplified34.2%
add-sqr-sqrt24.8%
sqrt-unprod24.2%
pow224.2%
clear-num24.2%
un-div-inv24.3%
Applied egg-rr24.3%
unpow224.3%
rem-sqrt-square32.7%
associate-/r/32.7%
rem-square-sqrt16.9%
/-rgt-identity16.9%
associate-*r/16.9%
rem-square-sqrt32.7%
times-frac31.1%
*-commutative31.1%
*-rgt-identity31.1%
associate-/l*32.7%
Simplified32.7%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.002) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.002) {
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) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.002d0) 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) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.002) {
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) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.002: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) 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) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.002], 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}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.002:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.6%
Taylor expanded in ky around 0 31.7%
associate-/l*33.8%
Simplified33.8%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.002) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.002) {
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 ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.002d0) 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 ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.002: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) 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 ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.002], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.002:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.6%
associate-*r/94.2%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
associate-*l/92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 33.8%
Taylor expanded in kx around 0 20.1%
associate-/l*22.2%
Simplified22.2%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.002) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (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) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.002d0) then
tmp = ky * (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) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.002: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.002], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.002:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.6%
associate-*r/94.2%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
associate-*l/92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 54.2%
Taylor expanded in ky around 0 19.2%
associate-/l*21.2%
Simplified21.2%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.002) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (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 ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.002d0) then
tmp = ky * (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 ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.002: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.002], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.002:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.6%
associate-*r/94.2%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
associate-*l/92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 54.2%
Taylor expanded in ky around 0 19.2%
associate-/l*21.2%
Simplified21.2%
Taylor expanded in kx around 0 18.1%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.002) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.002d0) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.002) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.002: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.002) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.002], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.002:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-3Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.6%
associate-*r/94.2%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
associate-*l/92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 54.2%
Taylor expanded in ky around 0 19.2%
associate-/l*21.2%
Simplified21.2%
Taylor expanded in kx around 0 18.1%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/85.9%
associate-/l*87.2%
+-commutative87.2%
unpow287.2%
sin-neg87.2%
sin-neg87.2%
Simplified99.6%
Taylor expanded in kx around 0 51.2%
Taylor expanded in th around 0 26.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (/ th (/ (hypot (sin ky) kx) (sin ky))) (if (<= (sin ky) 0.2) (* ky (/ (sin th) (hypot ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = th / (hypot(sin(ky), kx) / sin(ky));
} else if (sin(ky) <= 0.2) {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = th / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
} else if (Math.sin(ky) <= 0.2) {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = th / (math.hypot(math.sin(ky), kx) / math.sin(ky)) elif math.sin(ky) <= 0.2: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th / Float64(hypot(sin(ky), kx) / sin(ky))); elseif (sin(ky) <= 0.2) tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = th / (hypot(sin(ky), kx) / sin(ky)); elseif (sin(ky) <= 0.2) tmp = ky * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.2], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 0.2:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
associate-*r/99.6%
hypot-undefine99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 60.4%
Taylor expanded in kx around 0 30.5%
if -0.0100000000000000002 < (sin.f64 ky) < 0.20000000000000001Initial program 84.2%
unpow284.2%
sqr-neg84.2%
sin-neg84.2%
sin-neg84.2%
unpow284.2%
associate-*l/80.3%
associate-/l*84.2%
+-commutative84.2%
unpow284.2%
sin-neg84.2%
sin-neg84.2%
Simplified99.6%
Taylor expanded in ky around 0 95.2%
Taylor expanded in ky around 0 95.5%
if 0.20000000000000001 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.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 90.8%
+-commutative90.8%
unpow290.8%
unpow290.8%
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 90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
associate-*l/88.5%
associate-/l*90.8%
+-commutative90.8%
unpow290.8%
sin-neg90.8%
sin-neg90.8%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= th 8e-5) (/ th (/ (hypot (sin ky) (sin kx)) (sin ky))) (* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 8e-5) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 8e-5) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 8e-5: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 8e-5) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 8e-5) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 8e-5], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 8 \cdot 10^{-5}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 8.00000000000000065e-5Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/89.4%
associate-/l*92.4%
+-commutative92.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
Simplified99.6%
associate-*r/93.6%
hypot-undefine89.4%
unpow289.4%
unpow289.4%
+-commutative89.4%
associate-*l/92.4%
*-commutative92.4%
clear-num92.4%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 68.7%
if 8.00000000000000065e-5 < th Initial program 85.7%
unpow285.7%
sqr-neg85.7%
sin-neg85.7%
sin-neg85.7%
unpow285.7%
associate-*l/85.7%
associate-/l*85.8%
+-commutative85.8%
unpow285.8%
sin-neg85.8%
sin-neg85.8%
Simplified99.6%
Taylor expanded in ky around 0 53.9%
Taylor expanded in ky around 0 69.3%
(FPCore (kx ky th) :precision binary64 (if (<= th 3.8e-5) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 3.8e-5) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 3.8e-5) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 3.8e-5: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 3.8e-5) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 3.8e-5) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 3.8e-5], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 3.8 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 3.8000000000000002e-5Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/89.4%
associate-/l*92.4%
+-commutative92.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
Simplified99.6%
Taylor expanded in th around 0 68.7%
if 3.8000000000000002e-5 < th Initial program 85.7%
unpow285.7%
sqr-neg85.7%
sin-neg85.7%
sin-neg85.7%
unpow285.7%
associate-*l/85.7%
associate-/l*85.8%
+-commutative85.8%
unpow285.8%
sin-neg85.8%
sin-neg85.8%
Simplified99.6%
Taylor expanded in ky around 0 53.9%
Taylor expanded in ky around 0 69.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 0.2) (* ky (/ (sin th) (hypot ky (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 0.2) {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 0.2) {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 0.2: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 0.2) tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 0.2) tmp = ky * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 0.2], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 0.2:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 0.20000000000000001Initial program 88.3%
unpow288.3%
sqr-neg88.3%
sin-neg88.3%
sin-neg88.3%
unpow288.3%
associate-*l/85.4%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.6%
Taylor expanded in ky around 0 71.2%
Taylor expanded in ky around 0 77.7%
if 0.20000000000000001 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.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 90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
associate-*l/88.5%
associate-/l*90.8%
+-commutative90.8%
unpow290.8%
sin-neg90.8%
sin-neg90.8%
Simplified99.6%
Taylor expanded in kx around 0 18.4%
Taylor expanded in th around 0 10.6%
herbie shell --seed 2024191
(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)))