
(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 21 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.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.1)
(* (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))) (* ky (sin th)))
(if (<= (sin kx) 1e-51)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.1) {
tmp = sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))) * (ky * sin(th));
} else if (sin(kx) <= 1e-51) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} 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.1d0)) then
tmp = sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0)))))) * (ky * sin(th))
else if (sin(kx) <= 1d-51) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
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.1) {
tmp = Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0)))))) * (ky * Math.sin(th));
} else if (Math.sin(kx) <= 1e-51) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(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.1: tmp = math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) * (ky * math.sin(th)) elif math.sin(kx) <= 1e-51: tmp = math.sin(ky) * (math.sin(th) / math.fabs(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.1) tmp = Float64(sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0)))))) * Float64(ky * sin(th))); elseif (sin(kx) <= 1e-51) tmp = Float64(sin(ky) * Float64(sin(th) / abs(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.1) tmp = sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))) * (ky * sin(th)); elseif (sin(kx) <= 1e-51) tmp = sin(ky) * (sin(th) / abs(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.1], N[(N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-51], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $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.1:\\
\;\;\;\;\sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}} \cdot \left(ky \cdot \sin th\right)\\
\mathbf{elif}\;\sin kx \leq 10^{-51}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 99.3%
unpow299.3%
sin-mult99.4%
Applied egg-rr99.4%
div-sub99.4%
+-inverses99.4%
cos-099.4%
metadata-eval99.4%
count-299.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in ky around 0 51.7%
if -0.10000000000000001 < (sin.f64 kx) < 1e-51Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/80.8%
associate-/l*86.7%
+-commutative86.7%
unpow286.7%
sin-neg86.7%
sin-neg86.7%
Simplified99.8%
Taylor expanded in kx around 0 45.8%
add-sqr-sqrt44.4%
sqrt-prod69.4%
rem-sqrt-square77.0%
Applied egg-rr77.0%
if 1e-51 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in ky around 0 59.0%
Final simplification66.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.1) (* (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))) (* ky (sin th))) (if (<= (sin kx) 5e-70) (sin th) (/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.1) {
tmp = sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))) * (ky * sin(th));
} else if (sin(kx) <= 5e-70) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.1d0)) then
tmp = sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0)))))) * (ky * sin(th))
else if (sin(kx) <= 5d-70) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.1) {
tmp = Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0)))))) * (ky * Math.sin(th));
} else if (Math.sin(kx) <= 5e-70) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.1: tmp = math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) * (ky * math.sin(th)) elif math.sin(kx) <= 5e-70: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.1) tmp = Float64(sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0)))))) * Float64(ky * sin(th))); elseif (sin(kx) <= 5e-70) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.1) tmp = sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))) * (ky * sin(th)); elseif (sin(kx) <= 5e-70) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.1], N[(N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-70], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.1:\\
\;\;\;\;\sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}} \cdot \left(ky \cdot \sin th\right)\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 99.3%
unpow299.3%
sin-mult99.4%
Applied egg-rr99.4%
div-sub99.4%
+-inverses99.4%
cos-099.4%
metadata-eval99.4%
count-299.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in ky around 0 51.7%
if -0.10000000000000001 < (sin.f64 kx) < 4.9999999999999998e-70Initial program 86.2%
unpow286.2%
sqr-neg86.2%
sin-neg86.2%
sin-neg86.2%
unpow286.2%
associate-*l/80.0%
associate-/l*86.1%
+-commutative86.1%
unpow286.1%
sin-neg86.1%
sin-neg86.1%
Simplified99.8%
Taylor expanded in kx around 0 46.0%
if 4.9999999999999998e-70 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 55.7%
Final simplification50.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.1) (* (sin th) (/ ky (sqrt (- 0.5 (* 0.5 (cos (* kx 2.0))))))) (if (<= (sin kx) 5e-70) (sin th) (/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.1) {
tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 5e-70) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.1d0)) then
tmp = sin(th) * (ky / sqrt((0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 5d-70) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.1) {
tmp = Math.sin(th) * (ky / Math.sqrt((0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 5e-70) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.1: tmp = math.sin(th) * (ky / math.sqrt((0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 5e-70: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.1) tmp = Float64(sin(th) * Float64(ky / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 5e-70) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.1) tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 5e-70) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.1], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-70], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.1:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 99.3%
unpow299.3%
sin-mult99.4%
Applied egg-rr99.4%
div-sub99.4%
+-inverses99.4%
cos-099.4%
metadata-eval99.4%
count-299.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in ky around 0 60.6%
Taylor expanded in ky around 0 51.5%
if -0.10000000000000001 < (sin.f64 kx) < 4.9999999999999998e-70Initial program 86.2%
unpow286.2%
sqr-neg86.2%
sin-neg86.2%
sin-neg86.2%
unpow286.2%
associate-*l/80.0%
associate-/l*86.1%
+-commutative86.1%
unpow286.1%
sin-neg86.1%
sin-neg86.1%
Simplified99.8%
Taylor expanded in kx around 0 46.0%
if 4.9999999999999998e-70 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 55.7%
Final simplification50.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.515) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 2e-81) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.515) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-81) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.515d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 2d-81) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.515) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-81) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.515: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-81: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.515) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.515) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.515], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.515:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.515000000000000013Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.7%
sqrt-unprod23.9%
pow223.9%
Applied egg-rr23.9%
if -0.515000000000000013 < (sin.f64 ky) < 1.9999999999999999e-81Initial program 86.5%
Taylor expanded in ky around 0 44.1%
if 1.9999999999999999e-81 < (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 57.2%
Final simplification46.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.515) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 2e-81) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.515) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-81) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.515d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 2d-81) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.515) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-81) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.515: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-81: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.515) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.515) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.515], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.515:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.515000000000000013Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.7%
sqrt-unprod23.9%
pow223.9%
Applied egg-rr23.9%
if -0.515000000000000013 < (sin.f64 ky) < 1.9999999999999999e-81Initial program 86.5%
unpow286.5%
sqr-neg86.5%
sin-neg86.5%
sin-neg86.5%
unpow286.5%
associate-*l/80.7%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.6%
Taylor expanded in ky around 0 44.1%
if 1.9999999999999999e-81 < (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 57.2%
(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.3%
unpow293.3%
sqr-neg93.3%
sin-neg93.3%
sin-neg93.3%
unpow293.3%
associate-*l/90.4%
associate-/l*93.2%
+-commutative93.2%
unpow293.2%
sin-neg93.2%
sin-neg93.2%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.15)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (or (<= th 1.25e+79) (not (<= th 3.6e+175)))
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.15) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if ((th <= 1.25e+79) || !(th <= 3.6e+175)) {
tmp = sin(th) * (sin(ky) / fabs(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 (th <= 0.15) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 1.25e+79) || !(th <= 3.6e+175)) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(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 th <= 0.15: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 1.25e+79) or not (th <= 3.6e+175): tmp = math.sin(th) * (math.sin(ky) / math.fabs(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 (th <= 0.15) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif ((th <= 1.25e+79) || !(th <= 3.6e+175)) tmp = Float64(sin(th) * Float64(sin(ky) / abs(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 (th <= 0.15) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif ((th <= 1.25e+79) || ~((th <= 3.6e+175))) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.15], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 1.25e+79], N[Not[LessEqual[th, 3.6e+175]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $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}\;th \leq 0.15:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 1.25 \cdot 10^{+79} \lor \neg \left(th \leq 3.6 \cdot 10^{+175}\right):\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if th < 0.149999999999999994Initial program 94.1%
unpow294.1%
sqr-neg94.1%
sin-neg94.1%
sin-neg94.1%
unpow294.1%
associate-*l/90.3%
associate-/l*94.0%
+-commutative94.0%
unpow294.0%
sin-neg94.0%
sin-neg94.0%
Simplified99.6%
Taylor expanded in th around 0 63.5%
if 0.149999999999999994 < th < 1.25e79 or 3.60000000000000034e175 < th Initial program 89.2%
unpow289.2%
sin-mult76.7%
Applied egg-rr76.7%
div-sub76.7%
+-inverses76.7%
cos-076.7%
metadata-eval76.7%
count-276.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in ky around 0 38.5%
sqr-sin-a51.5%
rem-sqrt-square57.3%
Applied egg-rr57.3%
if 1.25e79 < th < 3.60000000000000034e175Initial program 93.0%
unpow293.0%
sqr-neg93.0%
sin-neg93.0%
sin-neg93.0%
unpow293.0%
associate-*l/92.9%
associate-/l*92.9%
+-commutative92.9%
unpow292.9%
sin-neg92.9%
sin-neg92.9%
Simplified99.7%
Taylor expanded in kx around 0 33.3%
add-sqr-sqrt32.4%
sqrt-prod51.8%
rem-sqrt-square58.8%
Applied egg-rr58.8%
Final simplification62.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.014) (* (sin th) (/ (sin ky) (hypot (sin ky) kx))) (* (* (sin ky) (sin th)) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.014) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.014) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.014: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = (math.sin(ky) * math.sin(th)) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.014) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.014) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = (sin(ky) * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.014], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.014:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\end{array}
\end{array}
if kx < 0.0140000000000000003Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 69.9%
if 0.0140000000000000003 < kx Initial program 99.5%
unpow299.5%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in ky around 0 47.0%
Taylor expanded in ky around inf 47.3%
Final simplification65.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.002) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 2e-81) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-81) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.002d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 2d-81) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.002) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-81) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.002: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-81: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.002) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-81) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial 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.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod22.4%
pow222.4%
Applied egg-rr22.4%
if -2e-3 < (sin.f64 ky) < 1.9999999999999999e-81Initial program 84.2%
Taylor expanded in ky around 0 50.6%
if 1.9999999999999999e-81 < (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 57.2%
Final simplification46.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.002) (fabs (sin th)) (if (<= (sin ky) 2e-81) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-81) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.002d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-81) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.002) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-81) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.002: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-81: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-81) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.002) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-81) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial 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.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square26.4%
associate-*r/26.4%
*-rgt-identity26.4%
times-frac26.5%
/-rgt-identity26.5%
*-inverses26.5%
*-lft-identity26.5%
Simplified26.5%
if -2e-3 < (sin.f64 ky) < 1.9999999999999999e-81Initial program 84.2%
Taylor expanded in ky around 0 50.6%
if 1.9999999999999999e-81 < (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 57.2%
Final simplification47.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.002) (fabs (sin th)) (if (<= (sin ky) 2e-81) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-81) {
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.002d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-81) 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.002) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-81) {
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.002: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-81: 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.002) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-81) 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.002) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-81) 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.002], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], 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.002:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial 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.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square26.4%
associate-*r/26.4%
*-rgt-identity26.4%
times-frac26.5%
/-rgt-identity26.5%
*-inverses26.5%
*-lft-identity26.5%
Simplified26.5%
if -2e-3 < (sin.f64 ky) < 1.9999999999999999e-81Initial program 84.2%
unpow284.2%
sqr-neg84.2%
sin-neg84.2%
sin-neg84.2%
unpow284.2%
associate-*l/77.3%
associate-/l*84.3%
+-commutative84.3%
unpow284.3%
sin-neg84.3%
sin-neg84.3%
Simplified99.6%
Taylor expanded in ky around 0 48.0%
associate-/l*50.7%
Simplified50.7%
if 1.9999999999999999e-81 < (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 57.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.036) (* (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.036) {
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.036) {
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.036: 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.036) 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.036) 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.036], 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.036:\\
\;\;\;\;\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.0359999999999999973Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 69.9%
if 0.0359999999999999973 < kx Initial program 99.5%
unpow299.5%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in ky around 0 47.0%
sqr-sin-a47.1%
rem-sqrt-square47.1%
Applied egg-rr47.1%
Final simplification65.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0052) (* (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.0052) {
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.0052) {
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.0052: 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.0052) 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.0052) 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.0052], 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.0052:\\
\;\;\;\;\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.0051999999999999998Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/87.9%
associate-/l*91.5%
+-commutative91.5%
unpow291.5%
sin-neg91.5%
sin-neg91.5%
Simplified99.6%
Taylor expanded in kx around 0 69.8%
if 0.0051999999999999998 < kx Initial program 99.5%
unpow299.5%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in ky around 0 47.0%
sqr-sin-a47.1%
rem-sqrt-square47.1%
Applied egg-rr47.1%
Final simplification64.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.102) (* (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.102) {
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.102) {
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.102: 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.102) 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.102) 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.102], 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.102:\\
\;\;\;\;\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.101999999999999993Initial program 90.9%
unpow290.9%
sqr-neg90.9%
sin-neg90.9%
sin-neg90.9%
unpow290.9%
associate-*l/86.9%
associate-/l*90.9%
+-commutative90.9%
unpow290.9%
sin-neg90.9%
sin-neg90.9%
Simplified99.6%
Taylor expanded in ky around 0 67.0%
if 0.101999999999999993 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 38.2%
add-sqr-sqrt37.0%
sqrt-prod58.9%
rem-sqrt-square58.9%
Applied egg-rr58.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.2e-14) (* (sin th) (/ (sin ky) (fabs (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.2e-14) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 5.2d-14) then
tmp = sin(th) * (sin(ky) / abs(sin(kx)))
else
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.2e-14) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(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 <= 5.2e-14: tmp = math.sin(th) * (math.sin(ky) / math.fabs(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 <= 5.2e-14) tmp = Float64(sin(th) * Float64(sin(ky) / abs(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 <= 5.2e-14) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.2e-14], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $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 5.2 \cdot 10^{-14}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 5.19999999999999993e-14Initial program 90.7%
unpow290.7%
sin-mult77.1%
Applied egg-rr77.1%
div-sub77.1%
+-inverses77.1%
cos-077.1%
metadata-eval77.1%
count-277.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in ky around 0 37.0%
sqr-sin-a51.1%
rem-sqrt-square55.5%
Applied egg-rr55.5%
if 5.19999999999999993e-14 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 39.2%
add-sqr-sqrt38.1%
sqrt-prod58.9%
rem-sqrt-square58.9%
Applied egg-rr58.9%
Final simplification56.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.6e-93) (+ (+ (sin th) 1.0) -1.0) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-93) {
tmp = (sin(th) + 1.0) + -1.0;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.6d-93) then
tmp = (sin(th) + 1.0d0) + (-1.0d0)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-93) {
tmp = (Math.sin(th) + 1.0) + -1.0;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.6e-93: tmp = (math.sin(th) + 1.0) + -1.0 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.6e-93) tmp = Float64(Float64(sin(th) + 1.0) + -1.0); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.6e-93) tmp = (sin(th) + 1.0) + -1.0; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.6e-93], N[(N[(N[Sin[th], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.6 \cdot 10^{-93}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.6000000000000002e-93Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/85.1%
associate-/l*89.6%
+-commutative89.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
Simplified99.6%
Taylor expanded in kx around 0 21.2%
expm1-log1p-u21.2%
expm1-undefine23.7%
Applied egg-rr23.7%
expm1-define21.2%
associate-*r/29.3%
*-rgt-identity29.3%
times-frac21.2%
/-rgt-identity21.2%
*-inverses21.2%
*-lft-identity21.2%
Simplified21.2%
expm1-undefine23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
if 3.6000000000000002e-93 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 38.8%
Final simplification29.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.05e-94) (+ 1.0 (+ (sin th) -1.0)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.05e-94) {
tmp = 1.0 + (sin(th) + -1.0);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.05d-94) then
tmp = 1.0d0 + (sin(th) + (-1.0d0))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.05e-94) {
tmp = 1.0 + (Math.sin(th) + -1.0);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.05e-94: tmp = 1.0 + (math.sin(th) + -1.0) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.05e-94) tmp = Float64(1.0 + Float64(sin(th) + -1.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.05e-94) tmp = 1.0 + (sin(th) + -1.0); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.05e-94], N[(1.0 + N[(N[Sin[th], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.05 \cdot 10^{-94}:\\
\;\;\;\;1 + \left(\sin th + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.05e-94Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/85.1%
associate-/l*89.6%
+-commutative89.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
Simplified99.6%
Taylor expanded in kx around 0 21.2%
expm1-log1p-u21.2%
expm1-undefine23.7%
Applied egg-rr23.7%
expm1-define21.2%
associate-*r/29.3%
*-rgt-identity29.3%
times-frac21.2%
/-rgt-identity21.2%
*-inverses21.2%
*-lft-identity21.2%
Simplified21.2%
expm1-undefine23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
sub-neg23.7%
+-commutative23.7%
associate-+l+23.7%
metadata-eval23.7%
Applied egg-rr23.7%
if 2.05e-94 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 38.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 95000.0) (sin th) (+ -1.0 (+ th 1.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 95000.0) {
tmp = sin(th);
} else {
tmp = -1.0 + (th + 1.0);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 95000.0d0) then
tmp = sin(th)
else
tmp = (-1.0d0) + (th + 1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 95000.0) {
tmp = Math.sin(th);
} else {
tmp = -1.0 + (th + 1.0);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 95000.0: tmp = math.sin(th) else: tmp = -1.0 + (th + 1.0) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 95000.0) tmp = sin(th); else tmp = Float64(-1.0 + Float64(th + 1.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 95000.0) tmp = sin(th); else tmp = -1.0 + (th + 1.0); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 95000.0], N[Sin[th], $MachinePrecision], N[(-1.0 + N[(th + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 95000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(th + 1\right)\\
\end{array}
\end{array}
if kx < 95000Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/87.9%
associate-/l*91.5%
+-commutative91.5%
unpow291.5%
sin-neg91.5%
sin-neg91.5%
Simplified99.6%
Taylor expanded in kx around 0 32.4%
if 95000 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in kx around 0 10.2%
expm1-log1p-u10.2%
expm1-undefine17.6%
Applied egg-rr17.6%
expm1-define10.2%
associate-*r/20.5%
*-rgt-identity20.5%
times-frac10.2%
/-rgt-identity10.2%
*-inverses10.2%
*-lft-identity10.2%
Simplified10.2%
expm1-undefine17.6%
log1p-undefine17.6%
rem-exp-log17.6%
+-commutative17.6%
Applied egg-rr17.6%
Taylor expanded in th around 0 14.7%
+-commutative14.7%
Simplified14.7%
Final simplification28.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.05e-94) (+ -1.0 (+ th 1.0)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.05e-94) {
tmp = -1.0 + (th + 1.0);
} 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 (ky <= 2.05d-94) then
tmp = (-1.0d0) + (th + 1.0d0)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.05e-94) {
tmp = -1.0 + (th + 1.0);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.05e-94: tmp = -1.0 + (th + 1.0) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.05e-94) tmp = Float64(-1.0 + Float64(th + 1.0)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.05e-94) tmp = -1.0 + (th + 1.0); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.05e-94], N[(-1.0 + N[(th + 1.0), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.05 \cdot 10^{-94}:\\
\;\;\;\;-1 + \left(th + 1\right)\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 2.05e-94Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/85.1%
associate-/l*89.6%
+-commutative89.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
Simplified99.6%
Taylor expanded in kx around 0 21.2%
expm1-log1p-u21.2%
expm1-undefine23.7%
Applied egg-rr23.7%
expm1-define21.2%
associate-*r/29.3%
*-rgt-identity29.3%
times-frac21.2%
/-rgt-identity21.2%
*-inverses21.2%
*-lft-identity21.2%
Simplified21.2%
expm1-undefine23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
Taylor expanded in th around 0 13.9%
+-commutative13.9%
Simplified13.9%
if 2.05e-94 < 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.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 38.8%
Taylor expanded in th around 0 25.1%
Final simplification18.0%
(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.3%
unpow293.3%
sqr-neg93.3%
sin-neg93.3%
sin-neg93.3%
unpow293.3%
associate-*l/90.4%
associate-/l*93.2%
+-commutative93.2%
unpow293.2%
sin-neg93.2%
sin-neg93.2%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
Taylor expanded in th around 0 16.3%
herbie shell --seed 2024149
(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)))