
(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 20 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 ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.965)
(fabs (sin th))
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-171)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= (sin ky) 4e-33)
(/ th (/ (hypot ky (sin kx)) (sin ky)))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.965) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-171) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 4e-33) {
tmp = th / (hypot(ky, sin(kx)) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.965) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-171) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 4e-33) {
tmp = th / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.965: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-171: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 4e-33: tmp = th / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.965) tmp = abs(sin(th)); elseif (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-171) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 4e-33) tmp = Float64(th / Float64(hypot(ky, sin(kx)) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.965) tmp = abs(sin(th)); elseif (sin(ky) <= -0.05) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-171) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 4e-33) tmp = th / (hypot(ky, sin(kx)) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.965], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-171], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-33], N[(th / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.965:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-171}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-33}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.964999999999999969Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt1.2%
sqrt-unprod41.3%
pow241.3%
Applied egg-rr41.3%
unpow241.3%
rem-sqrt-square41.2%
associate-*r/41.3%
associate-*l/41.3%
*-inverses41.3%
*-lft-identity41.3%
Simplified41.3%
if -0.964999999999999969 < (sin.f64 ky) < -0.050000000000000003Initial 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 2.3%
Taylor expanded in th around 0 3.1%
add-sqr-sqrt0.0%
sqrt-prod50.5%
rem-sqrt-square50.5%
Applied egg-rr25.0%
if -0.050000000000000003 < (sin.f64 ky) < 2e-171Initial program 81.7%
unpow281.7%
sqr-neg81.7%
sin-neg81.7%
sin-neg81.7%
unpow281.7%
associate-*l/76.4%
associate-/l*81.7%
+-commutative81.7%
unpow281.7%
sin-neg81.7%
sin-neg81.7%
Simplified99.8%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 45.2%
if 2e-171 < (sin.f64 ky) < 4.0000000000000002e-33Initial program 97.7%
unpow297.7%
sqr-neg97.7%
sin-neg97.7%
sin-neg97.7%
unpow297.7%
associate-*l/92.8%
associate-/l*97.5%
+-commutative97.5%
unpow297.5%
sin-neg97.5%
sin-neg97.5%
Simplified99.5%
Taylor expanded in th around 0 53.8%
associate-*l*58.6%
sqrt-div59.5%
metadata-eval59.5%
+-commutative59.5%
unpow259.5%
unpow259.5%
hypot-undefine61.5%
div-inv61.6%
clear-num61.5%
un-div-inv61.6%
Applied egg-rr61.6%
Taylor expanded in ky around 0 61.6%
if 4.0000000000000002e-33 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 49.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.002)
(/ th (/ (hypot ky (sin kx)) (sin ky)))
(if (<= (sin kx) 5e-165)
(sin th)
(if (<= (sin kx) 5e-12)
(/ th (/ (hypot (sin ky) kx) (sin ky)))
(* (sin ky) (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.002) {
tmp = th / (hypot(ky, sin(kx)) / sin(ky));
} else if (sin(kx) <= 5e-165) {
tmp = sin(th);
} else if (sin(kx) <= 5e-12) {
tmp = th / (hypot(sin(ky), kx) / sin(ky));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.002) {
tmp = th / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else if (Math.sin(kx) <= 5e-165) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-12) {
tmp = th / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.002: tmp = th / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) elif math.sin(kx) <= 5e-165: tmp = math.sin(th) elif math.sin(kx) <= 5e-12: tmp = th / (math.hypot(math.sin(ky), kx) / math.sin(ky)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.002) tmp = Float64(th / Float64(hypot(ky, sin(kx)) / sin(ky))); elseif (sin(kx) <= 5e-165) tmp = sin(th); elseif (sin(kx) <= 5e-12) tmp = Float64(th / Float64(hypot(sin(ky), kx) / sin(ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.002) tmp = th / (hypot(ky, sin(kx)) / sin(ky)); elseif (sin(kx) <= 5e-165) tmp = sin(th); elseif (sin(kx) <= 5e-12) tmp = th / (hypot(sin(ky), kx) / sin(ky)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.002], N[(th / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-165], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-12], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.002:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-165}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -2e-3Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in th around 0 45.6%
associate-*l*45.6%
sqrt-div45.5%
metadata-eval45.5%
+-commutative45.5%
unpow245.5%
unpow245.5%
hypot-undefine45.5%
div-inv45.7%
clear-num45.6%
un-div-inv45.6%
Applied egg-rr45.6%
Taylor expanded in ky around 0 21.2%
if -2e-3 < (sin.f64 kx) < 4.99999999999999981e-165Initial program 81.0%
unpow281.0%
sqr-neg81.0%
sin-neg81.0%
sin-neg81.0%
unpow281.0%
associate-*l/75.8%
associate-/l*80.9%
+-commutative80.9%
unpow280.9%
sin-neg80.9%
sin-neg80.9%
Simplified99.7%
Taylor expanded in kx around 0 38.2%
if 4.99999999999999981e-165 < (sin.f64 kx) < 4.9999999999999997e-12Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/93.1%
associate-/l*99.8%
+-commutative99.8%
unpow299.8%
sin-neg99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in th around 0 44.8%
associate-*l*51.6%
sqrt-div51.6%
metadata-eval51.6%
+-commutative51.6%
unpow251.6%
unpow251.6%
hypot-undefine51.6%
div-inv51.7%
clear-num51.6%
un-div-inv51.7%
Applied egg-rr51.7%
Taylor expanded in kx around 0 51.7%
if 4.9999999999999997e-12 < (sin.f64 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%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in ky around 0 56.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.965)
(fabs (sin th))
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (fabs (sin ky))))
(if (<= (sin ky) 2e-105) (/ (sin th) (/ (sin kx) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.965) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / fabs(sin(ky)));
} else if (sin(ky) <= 2e-105) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.965d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * (th / abs(sin(ky)))
else if (sin(ky) <= 2d-105) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.965) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.abs(Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-105) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.965: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.fabs(math.sin(ky))) elif math.sin(ky) <= 2e-105: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.965) tmp = abs(sin(th)); elseif (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / abs(sin(ky)))); elseif (sin(ky) <= 2e-105) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.965) tmp = abs(sin(th)); elseif (sin(ky) <= -0.05) tmp = sin(ky) * (th / abs(sin(ky))); elseif (sin(ky) <= 2e-105) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.965], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-105], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.965:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\left|\sin ky\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-105}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.964999999999999969Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt1.2%
sqrt-unprod41.3%
pow241.3%
Applied egg-rr41.3%
unpow241.3%
rem-sqrt-square41.2%
associate-*r/41.3%
associate-*l/41.3%
*-inverses41.3%
*-lft-identity41.3%
Simplified41.3%
if -0.964999999999999969 < (sin.f64 ky) < -0.050000000000000003Initial 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 2.3%
Taylor expanded in th around 0 3.1%
add-sqr-sqrt0.0%
sqrt-prod50.5%
rem-sqrt-square50.5%
Applied egg-rr25.0%
if -0.050000000000000003 < (sin.f64 ky) < 1.99999999999999993e-105Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/78.5%
associate-/l*83.7%
+-commutative83.7%
unpow283.7%
sin-neg83.7%
sin-neg83.7%
Simplified99.8%
associate-*r/90.9%
hypot-undefine78.5%
unpow278.5%
unpow278.5%
+-commutative78.5%
associate-*l/83.7%
*-commutative83.7%
clear-num83.6%
un-div-inv83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 47.4%
if 1.99999999999999993e-105 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 47.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.002) (fabs (* th (/ ky (sin kx)))) (if (<= (sin kx) 1e-143) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.002) {
tmp = fabs((th * (ky / sin(kx))));
} else if (sin(kx) <= 1e-143) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.002d0)) then
tmp = abs((th * (ky / sin(kx))))
else if (sin(kx) <= 1d-143) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.002) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-143) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.002: tmp = math.fabs((th * (ky / math.sin(kx)))) elif math.sin(kx) <= 1e-143: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.002) tmp = abs(Float64(th * Float64(ky / sin(kx)))); elseif (sin(kx) <= 1e-143) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.002) tmp = abs((th * (ky / sin(kx)))); elseif (sin(kx) <= 1e-143) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.002], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-143], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.002:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-143}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -2e-3Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in th around 0 45.6%
Taylor expanded in ky around 0 8.8%
add-sqr-sqrt7.6%
sqrt-unprod12.0%
pow212.0%
associate-/l*12.0%
Applied egg-rr12.0%
unpow212.0%
rem-sqrt-square14.8%
*-commutative14.8%
associate-*l/14.8%
associate-*r/14.8%
Simplified14.8%
if -2e-3 < (sin.f64 kx) < 9.9999999999999995e-144Initial program 82.1%
unpow282.1%
sqr-neg82.1%
sin-neg82.1%
sin-neg82.1%
unpow282.1%
associate-*l/77.1%
associate-/l*81.9%
+-commutative81.9%
unpow281.9%
sin-neg81.9%
sin-neg81.9%
Simplified99.7%
Taylor expanded in kx around 0 40.6%
if 9.9999999999999995e-144 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/97.9%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.4%
(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 93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
associate-*l/91.0%
associate-/l*93.3%
+-commutative93.3%
unpow293.3%
sin-neg93.3%
sin-neg93.3%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0037)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 5e+168)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin th) (/ (sin ky) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0037) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 5e+168) {
tmp = sin(ky) * (sin(th) / fabs(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 (th <= 0.0037) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 5e+168) {
tmp = Math.sin(ky) * (Math.sin(th) / 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 th <= 0.0037: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 5e+168: tmp = math.sin(ky) * (math.sin(th) / 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 (th <= 0.0037) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 5e+168) tmp = Float64(sin(ky) * Float64(sin(th) / 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 (th <= 0.0037) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 5e+168) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0037], 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, 5e+168], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $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}\;th \leq 0.0037:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 5 \cdot 10^{+168}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if th < 0.0037000000000000002Initial program 92.7%
unpow292.7%
sqr-neg92.7%
sin-neg92.7%
sin-neg92.7%
unpow292.7%
associate-*l/89.4%
associate-/l*92.6%
+-commutative92.6%
unpow292.6%
sin-neg92.6%
sin-neg92.6%
Simplified99.6%
Taylor expanded in th around 0 66.4%
if 0.0037000000000000002 < th < 4.99999999999999967e168Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/94.3%
associate-/l*94.4%
+-commutative94.4%
unpow294.4%
sin-neg94.4%
sin-neg94.4%
Simplified99.7%
Taylor expanded in kx around 0 19.9%
add-sqr-sqrt18.9%
sqrt-prod43.3%
rem-sqrt-square43.9%
Applied egg-rr43.9%
if 4.99999999999999967e168 < th Initial program 96.5%
Taylor expanded in ky around 0 30.9%
add-sqr-sqrt30.0%
sqrt-prod44.0%
rem-sqrt-square47.2%
Applied egg-rr47.2%
Final simplification60.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 1.1e-171)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= ky 3.5e-22)
(/ th (/ (hypot ky (sin kx)) (sin ky)))
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.1e-171) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (ky <= 3.5e-22) {
tmp = th / (hypot(ky, sin(kx)) / sin(ky));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.1e-171) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (ky <= 3.5e-22) {
tmp = th / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.1e-171: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif ky <= 3.5e-22: tmp = th / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.1e-171) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (ky <= 3.5e-22) tmp = Float64(th / Float64(hypot(ky, sin(kx)) / sin(ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.1e-171) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (ky <= 3.5e-22) tmp = th / (hypot(ky, sin(kx)) / sin(ky)); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.1e-171], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3.5e-22], N[(th / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.1 \cdot 10^{-171}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;ky \leq 3.5 \cdot 10^{-22}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 1.1000000000000001e-171Initial program 89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
associate-*l/87.0%
associate-/l*89.9%
+-commutative89.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 28.9%
if 1.1000000000000001e-171 < ky < 3.50000000000000005e-22Initial program 97.7%
unpow297.7%
sqr-neg97.7%
sin-neg97.7%
sin-neg97.7%
unpow297.7%
associate-*l/92.8%
associate-/l*97.5%
+-commutative97.5%
unpow297.5%
sin-neg97.5%
sin-neg97.5%
Simplified99.5%
Taylor expanded in th around 0 53.8%
associate-*l*58.6%
sqrt-div59.5%
metadata-eval59.5%
+-commutative59.5%
unpow259.5%
unpow259.5%
hypot-undefine61.5%
div-inv61.6%
clear-num61.5%
un-div-inv61.6%
Applied egg-rr61.6%
Taylor expanded in ky around 0 61.6%
if 3.50000000000000005e-22 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 24.9%
add-sqr-sqrt23.7%
sqrt-prod52.1%
rem-sqrt-square52.1%
Applied egg-rr52.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 2e-105) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-105) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-105) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-105) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-105: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-105) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-105) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-105], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-105}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial 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 2.3%
add-sqr-sqrt1.2%
sqrt-unprod21.1%
pow221.1%
Applied egg-rr21.1%
unpow221.1%
rem-sqrt-square23.0%
associate-*r/23.0%
associate-*l/23.0%
*-inverses23.0%
*-lft-identity23.0%
Simplified23.0%
if -0.050000000000000003 < (sin.f64 ky) < 1.99999999999999993e-105Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/78.5%
associate-/l*83.7%
+-commutative83.7%
unpow283.7%
sin-neg83.7%
sin-neg83.7%
Simplified99.8%
associate-*r/90.9%
hypot-undefine78.5%
unpow278.5%
unpow278.5%
+-commutative78.5%
associate-*l/83.7%
*-commutative83.7%
clear-num83.6%
un-div-inv83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 47.4%
if 1.99999999999999993e-105 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 47.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 2e-105) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-105) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-105) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-105) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-105: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-105) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-105) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-105], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-105}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial 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 2.3%
add-sqr-sqrt1.2%
sqrt-unprod21.1%
pow221.1%
Applied egg-rr21.1%
unpow221.1%
rem-sqrt-square23.0%
associate-*r/23.0%
associate-*l/23.0%
*-inverses23.0%
*-lft-identity23.0%
Simplified23.0%
if -0.050000000000000003 < (sin.f64 ky) < 1.99999999999999993e-105Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/78.5%
associate-/l*83.7%
+-commutative83.7%
unpow283.7%
sin-neg83.7%
sin-neg83.7%
Simplified99.8%
Taylor expanded in ky around 0 46.7%
associate-/l*47.3%
Simplified47.3%
if 1.99999999999999993e-105 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 47.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0205) (* (sin th) (/ (sin ky) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0205) {
tmp = sin(th) * (sin(ky) / 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.0205) {
tmp = Math.sin(th) * (Math.sin(ky) / 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.0205: tmp = math.sin(th) * (math.sin(ky) / 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.0205) tmp = Float64(sin(th) * Float64(sin(ky) / 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.0205) tmp = sin(th) * (sin(ky) / 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.0205], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $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.0205:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\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.0205000000000000009Initial program 90.7%
+-commutative90.7%
unpow290.7%
unpow290.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 68.9%
if 0.0205000000000000009 < kx Initial program 99.5%
Taylor expanded in ky around 0 35.7%
add-sqr-sqrt32.1%
sqrt-prod54.1%
rem-sqrt-square54.1%
Applied egg-rr54.1%
Final simplification64.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0205) (* (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.0205) {
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.0205) {
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.0205: 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.0205) 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.0205) 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.0205], 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.0205:\\
\;\;\;\;\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.0205000000000000009Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/87.2%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.6%
Taylor expanded in kx around 0 68.8%
if 0.0205000000000000009 < kx Initial program 99.5%
Taylor expanded in ky around 0 35.7%
add-sqr-sqrt32.1%
sqrt-prod54.1%
rem-sqrt-square54.1%
Applied egg-rr54.1%
Final simplification64.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.00185) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00185) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00185) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.00185: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00185) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.00185) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00185], 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[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00185:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.0018500000000000001Initial program 91.4%
unpow291.4%
sqr-neg91.4%
sin-neg91.4%
sin-neg91.4%
unpow291.4%
associate-*l/88.1%
associate-/l*91.3%
+-commutative91.3%
unpow291.3%
sin-neg91.3%
sin-neg91.3%
Simplified99.6%
Taylor expanded in ky around 0 62.8%
if 0.0018500000000000001 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 25.3%
add-sqr-sqrt24.1%
sqrt-prod53.4%
rem-sqrt-square53.4%
Applied egg-rr53.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.1e-11) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.1e-11) {
tmp = sin(ky) * (sin(th) / 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 <= 1.1d-11) then
tmp = sin(ky) * (sin(th) / 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 <= 1.1e-11) {
tmp = Math.sin(ky) * (Math.sin(th) / 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 <= 1.1e-11: tmp = math.sin(ky) * (math.sin(th) / 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 <= 1.1e-11) tmp = Float64(sin(ky) * Float64(sin(th) / 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 <= 1.1e-11) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.1e-11], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $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 1.1 \cdot 10^{-11}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 1.1000000000000001e-11Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/87.0%
associate-/l*90.4%
+-commutative90.4%
unpow290.4%
sin-neg90.4%
sin-neg90.4%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
add-sqr-sqrt25.8%
sqrt-prod50.3%
rem-sqrt-square56.8%
Applied egg-rr56.8%
if 1.1000000000000001e-11 < kx Initial program 99.5%
Taylor expanded in ky around 0 37.0%
add-sqr-sqrt33.5%
sqrt-prod54.7%
rem-sqrt-square54.7%
Applied egg-rr54.7%
Final simplification56.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.15) (sin th) (fabs (* th (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = sin(th);
} else {
tmp = fabs((th * (ky / sin(kx))));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.15d0) then
tmp = sin(th)
else
tmp = abs((th * (ky / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = Math.sin(th);
} else {
tmp = Math.abs((th * (ky / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.15: tmp = math.sin(th) else: tmp = math.fabs((th * (ky / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.15) tmp = sin(th); else tmp = abs(Float64(th * Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.15) tmp = sin(th); else tmp = abs((th * (ky / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.15], N[Sin[th], $MachinePrecision], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.15:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 1.1499999999999999Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/87.2%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
if 1.1499999999999999 < 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%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in th around 0 54.3%
Taylor expanded in ky around 0 21.1%
add-sqr-sqrt15.0%
sqrt-unprod13.6%
pow213.6%
associate-/l*13.6%
Applied egg-rr13.6%
unpow213.6%
rem-sqrt-square18.0%
*-commutative18.0%
associate-*l/18.0%
associate-*r/18.0%
Simplified18.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.15) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.15d0) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.15: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.15) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.15) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.15], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.15:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.1499999999999999Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/87.2%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
if 1.1499999999999999 < 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%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in th around 0 54.3%
Taylor expanded in ky around 0 21.1%
associate-/l*21.1%
*-commutative21.1%
Applied egg-rr21.1%
Final simplification25.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.15) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = sin(th);
} else {
tmp = th * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.15d0) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.15: tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.15) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.15) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.15], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.15:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.1499999999999999Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/87.2%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
if 1.1499999999999999 < 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%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in th around 0 54.3%
associate-*l*54.4%
sqrt-div54.4%
metadata-eval54.4%
+-commutative54.4%
unpow254.4%
unpow254.4%
hypot-undefine54.4%
div-inv54.5%
clear-num54.4%
un-div-inv54.5%
Applied egg-rr54.5%
Taylor expanded in ky around 0 21.1%
associate-*l/21.1%
*-commutative21.1%
Simplified21.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.15e-132) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.15e-132) {
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 (ky <= 1.15d-132) 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 (ky <= 1.15e-132) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.15e-132: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.15e-132) 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 (ky <= 1.15e-132) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.15e-132], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.15 \cdot 10^{-132}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.15000000000000002e-132Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/87.3%
associate-/l*90.0%
+-commutative90.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
Simplified99.7%
Taylor expanded in th around 0 42.9%
Taylor expanded in ky around 0 19.1%
Taylor expanded in kx around 0 15.7%
associate-/l*15.5%
Simplified15.5%
if 1.15000000000000002e-132 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.7%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 28.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.1e-126) th (* ky (/ th kx))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.1e-126) {
tmp = th;
} else {
tmp = ky * (th / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 5.1d-126) then
tmp = th
else
tmp = ky * (th / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.1e-126) {
tmp = th;
} else {
tmp = ky * (th / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.1e-126: tmp = th else: tmp = ky * (th / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.1e-126) tmp = th; else tmp = Float64(ky * Float64(th / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 5.1e-126) tmp = th; else tmp = ky * (th / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.1e-126], th, N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.1 \cdot 10^{-126}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\end{array}
\end{array}
if kx < 5.10000000000000002e-126Initial program 89.4%
unpow289.4%
sqr-neg89.4%
sin-neg89.4%
sin-neg89.4%
unpow289.4%
associate-*l/86.5%
associate-/l*89.3%
+-commutative89.3%
unpow289.3%
sin-neg89.3%
sin-neg89.3%
Simplified99.6%
Taylor expanded in kx around 0 27.3%
Taylor expanded in th around 0 15.8%
if 5.10000000000000002e-126 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/97.9%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in th around 0 51.7%
Taylor expanded in ky around 0 21.9%
Taylor expanded in kx around 0 16.7%
associate-/l*17.3%
Simplified17.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 93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
associate-*l/91.0%
associate-/l*93.3%
+-commutative93.3%
unpow293.3%
sin-neg93.3%
sin-neg93.3%
Simplified99.6%
Taylor expanded in kx around 0 21.6%
Taylor expanded in th around 0 12.5%
herbie shell --seed 2024154
(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)))