
(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 18 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 91.2%
+-commutative91.2%
unpow291.2%
unpow291.2%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 4e-6)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 4e-6) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 4e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(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.02: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 4e-6: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 4e-6) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 4e-6) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 51.5%
associate-*l/51.7%
+-commutative51.7%
unpow251.7%
unpow251.7%
hypot-undefine51.7%
*-lft-identity51.7%
hypot-undefine51.7%
unpow251.7%
unpow251.7%
+-commutative51.7%
unpow251.7%
unpow251.7%
hypot-define51.7%
Simplified51.7%
if -0.0200000000000000004 < (sin.f64 ky) < 3.99999999999999982e-6Initial program 83.5%
unpow283.5%
sqr-neg83.5%
sin-neg83.5%
sin-neg83.5%
unpow283.5%
associate-*l/80.6%
associate-/l*83.5%
unpow283.5%
Simplified99.7%
associate-*r/91.4%
clear-num90.1%
*-commutative90.1%
Applied egg-rr90.1%
Taylor expanded in ky around 0 89.9%
clear-num91.2%
associate-/l*99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/91.2%
associate-*r/99.5%
Simplified99.5%
if 3.99999999999999982e-6 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 55.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 4e-6)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 4e-6) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 4e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(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.02: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 4e-6: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 4e-6) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 4e-6) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.7%
Simplified33.7%
if -0.0200000000000000004 < (sin.f64 ky) < 3.99999999999999982e-6Initial program 83.5%
unpow283.5%
sqr-neg83.5%
sin-neg83.5%
sin-neg83.5%
unpow283.5%
associate-*l/80.6%
associate-/l*83.5%
unpow283.5%
Simplified99.7%
associate-*r/91.4%
clear-num90.1%
*-commutative90.1%
Applied egg-rr90.1%
Taylor expanded in ky around 0 89.9%
clear-num91.2%
associate-/l*99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*l/91.2%
associate-*r/99.5%
Simplified99.5%
if 3.99999999999999982e-6 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 55.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-54)
(/ (sin th) (fabs (/ (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-54) {
tmp = sin(th) / fabs((sin(kx) / sin(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.02d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 1d-54) then
tmp = sin(th) / abs((sin(kx) / sin(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.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-54) {
tmp = Math.sin(th) / Math.abs((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.02: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-54: tmp = math.sin(th) / math.fabs((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.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-54) tmp = Float64(sin(th) / abs(Float64(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.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-54) tmp = sin(th) / abs((sin(kx) / sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-54], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-54}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{\sin ky}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.7%
Simplified33.7%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-54Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-undefine99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 53.1%
add-sqr-sqrt28.4%
sqrt-unprod46.1%
pow246.1%
Applied egg-rr46.1%
unpow246.1%
rem-sqrt-square55.3%
Simplified55.3%
if 1e-54 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 57.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-54)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-54) {
tmp = fabs((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.02d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 1d-54) then
tmp = abs((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.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-54) {
tmp = Math.abs((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.02: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-54: tmp = math.fabs((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.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-54) tmp = abs(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.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-54) tmp = abs((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.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-54], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-54}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.7%
Simplified33.7%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-54Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-undefine99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 53.1%
add-sqr-sqrt38.0%
sqrt-unprod36.7%
pow236.7%
associate-/r/36.7%
*-commutative36.7%
Applied egg-rr36.7%
unpow236.7%
rem-sqrt-square51.0%
*-commutative51.0%
associate-*l/49.6%
associate-*r/51.1%
Simplified51.1%
if 1e-54 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 57.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.035) (fabs (* (sin th) (/ (sin ky) (sin kx)))) (if (<= (sin kx) 2e-82) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.035) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 2e-82) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / 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 (sin(kx) <= (-0.035d0)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(kx) <= 2d-82) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.035) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-82) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.035: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 2e-82: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.035) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-82) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.035) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-82) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.035], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-82], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.035:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-82}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.035000000000000003Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.4%
Applied egg-rr99.4%
*-commutative99.4%
clear-num99.5%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 19.6%
add-sqr-sqrt18.3%
sqrt-unprod28.9%
pow228.9%
associate-/r/28.9%
*-commutative28.9%
Applied egg-rr28.9%
unpow228.9%
rem-sqrt-square40.7%
*-commutative40.7%
associate-*l/40.7%
associate-*r/40.8%
Simplified40.8%
if -0.035000000000000003 < (sin.f64 kx) < 2e-82Initial program 81.0%
unpow281.0%
sqr-neg81.0%
sin-neg81.0%
sin-neg81.0%
unpow281.0%
associate-*l/77.6%
associate-/l*80.9%
unpow280.9%
Simplified99.8%
Taylor expanded in kx around 0 42.0%
if 2e-82 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 61.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.035) (/ 1.0 (/ (hypot (sin ky) (sin kx)) (* ky th))) (if (<= (sin kx) 2e-82) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.035) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * th));
} else if (sin(kx) <= 2e-82) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.035) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (ky * th));
} else if (Math.sin(kx) <= 2e-82) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.035: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (ky * th)) elif math.sin(kx) <= 2e-82: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.035) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(ky * th))); elseif (sin(kx) <= 2e-82) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.035) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * th)); elseif (sin(kx) <= 2e-82) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.035], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(ky * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-82], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.035:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky \cdot th}}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-82}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.035000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.4%
associate-*r/99.5%
clear-num99.3%
*-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 48.3%
Taylor expanded in th around 0 34.5%
*-commutative34.5%
Simplified34.5%
if -0.035000000000000003 < (sin.f64 kx) < 2e-82Initial program 81.0%
unpow281.0%
sqr-neg81.0%
sin-neg81.0%
sin-neg81.0%
unpow281.0%
associate-*l/77.6%
associate-/l*80.9%
unpow280.9%
Simplified99.8%
Taylor expanded in kx around 0 42.0%
if 2e-82 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 61.9%
Final simplification46.1%
(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 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/89.7%
associate-/l*91.1%
unpow291.1%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-57) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-57) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-57) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-57) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-57: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-57) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-57) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-57], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-57}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod29.3%
pow229.3%
Applied egg-rr29.3%
unpow229.3%
rem-sqrt-square36.2%
associate-*r/36.3%
*-rgt-identity36.3%
times-frac36.3%
/-rgt-identity36.3%
*-inverses36.3%
*-lft-identity36.3%
Simplified36.3%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999955e-58Initial program 82.6%
Taylor expanded in ky around 0 53.1%
if 9.99999999999999955e-58 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 57.0%
Final simplification50.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-57) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-57) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-57) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-57) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-57: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-57) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-57) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-57], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-57}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod29.3%
pow229.3%
Applied egg-rr29.3%
unpow229.3%
rem-sqrt-square36.2%
associate-*r/36.3%
*-rgt-identity36.3%
times-frac36.3%
/-rgt-identity36.3%
*-inverses36.3%
*-lft-identity36.3%
Simplified36.3%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999955e-58Initial program 82.6%
unpow282.6%
sqr-neg82.6%
sin-neg82.6%
sin-neg82.6%
unpow282.6%
associate-*l/79.6%
associate-/l*82.6%
unpow282.6%
Simplified99.7%
Taylor expanded in ky around 0 51.0%
associate-/l*53.0%
Simplified53.0%
if 9.99999999999999955e-58 < (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.6%
unpow299.6%
Simplified99.5%
Taylor expanded in kx around 0 57.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.05e-81) (sin th) (/ (sin th) (/ (sin kx) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-81) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / 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 (kx <= 1.05d-81) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-81) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.05e-81: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.05e-81) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.05e-81) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.05e-81], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.05 \cdot 10^{-81}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if kx < 1.05e-81Initial program 87.7%
unpow287.7%
sqr-neg87.7%
sin-neg87.7%
sin-neg87.7%
unpow287.7%
associate-*l/85.6%
associate-/l*87.7%
unpow287.7%
Simplified99.6%
Taylor expanded in kx around 0 30.0%
if 1.05e-81 < kx Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 45.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.8e-82) (sin th) (/ (sin ky) (/ (sin kx) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.8e-82) {
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 (kx <= 5.8d-82) 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 (kx <= 5.8e-82) {
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 kx <= 5.8e-82: 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 (kx <= 5.8e-82) 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 (kx <= 5.8e-82) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.8e-82], 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}\;kx \leq 5.8 \cdot 10^{-82}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if kx < 5.79999999999999954e-82Initial program 87.7%
unpow287.7%
sqr-neg87.7%
sin-neg87.7%
sin-neg87.7%
unpow287.7%
associate-*l/85.6%
associate-/l*87.7%
unpow287.7%
Simplified99.6%
Taylor expanded in kx around 0 30.0%
if 5.79999999999999954e-82 < kx 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%
unpow299.5%
Simplified99.5%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 45.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.6e-82) (sin th) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.6e-82) {
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 (kx <= 2.6d-82) 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 (kx <= 2.6e-82) {
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 kx <= 2.6e-82: 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 (kx <= 2.6e-82) 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 (kx <= 2.6e-82) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.6e-82], 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}\;kx \leq 2.6 \cdot 10^{-82}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 2.6e-82Initial program 87.7%
unpow287.7%
sqr-neg87.7%
sin-neg87.7%
sin-neg87.7%
unpow287.7%
associate-*l/85.6%
associate-/l*87.7%
unpow287.7%
Simplified99.6%
Taylor expanded in kx around 0 30.0%
if 2.6e-82 < kx 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%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 45.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 8.5e-122) (sin th) (+ (+ (sin th) 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.5e-122) {
tmp = sin(th);
} else {
tmp = (sin(th) + 1.0) + -1.0;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 8.5d-122) then
tmp = sin(th)
else
tmp = (sin(th) + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.5e-122) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 8.5e-122: tmp = math.sin(th) else: tmp = (math.sin(th) + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 8.5e-122) tmp = sin(th); else tmp = Float64(Float64(sin(th) + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 8.5e-122) tmp = sin(th); else tmp = (sin(th) + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 8.5e-122], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 8.5 \cdot 10^{-122}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 8.50000000000000003e-122Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/85.2%
associate-/l*87.0%
unpow287.0%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
if 8.50000000000000003e-122 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 12.5%
expm1-log1p-u12.5%
expm1-undefine26.9%
Applied egg-rr26.9%
expm1-define12.5%
associate-*r/27.7%
*-rgt-identity27.7%
times-frac12.5%
/-rgt-identity12.5%
*-inverses12.5%
*-lft-identity12.5%
Simplified12.5%
expm1-undefine26.9%
log1p-undefine26.9%
rem-exp-log26.9%
+-commutative26.9%
Applied egg-rr26.9%
Final simplification28.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 8.6e-122) (sin th) (+ 1.0 (+ (sin th) -1.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.6e-122) {
tmp = sin(th);
} else {
tmp = 1.0 + (sin(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 <= 8.6d-122) then
tmp = sin(th)
else
tmp = 1.0d0 + (sin(th) + (-1.0d0))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.6e-122) {
tmp = Math.sin(th);
} else {
tmp = 1.0 + (Math.sin(th) + -1.0);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 8.6e-122: tmp = math.sin(th) else: tmp = 1.0 + (math.sin(th) + -1.0) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 8.6e-122) tmp = sin(th); else tmp = Float64(1.0 + Float64(sin(th) + -1.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 8.6e-122) tmp = sin(th); else tmp = 1.0 + (sin(th) + -1.0); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 8.6e-122], N[Sin[th], $MachinePrecision], N[(1.0 + N[(N[Sin[th], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 8.6 \cdot 10^{-122}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sin th + -1\right)\\
\end{array}
\end{array}
if kx < 8.60000000000000037e-122Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/85.2%
associate-/l*87.0%
unpow287.0%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
if 8.60000000000000037e-122 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 12.5%
expm1-log1p-u12.5%
expm1-undefine26.9%
Applied egg-rr26.9%
expm1-define12.5%
associate-*r/27.7%
*-rgt-identity27.7%
times-frac12.5%
/-rgt-identity12.5%
*-inverses12.5%
*-lft-identity12.5%
Simplified12.5%
expm1-undefine26.9%
log1p-undefine26.9%
rem-exp-log26.9%
+-commutative26.9%
Applied egg-rr26.9%
sub-neg26.9%
+-commutative26.9%
metadata-eval26.9%
associate-+l+26.9%
Applied egg-rr26.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.1e-62) (sin th) 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-62) {
tmp = sin(th);
} else {
tmp = 0.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 <= 3.1d-62) then
tmp = sin(th)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.1e-62) {
tmp = Math.sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.1e-62: tmp = math.sin(th) else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.1e-62) tmp = sin(th); else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.1e-62) tmp = sin(th); else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.1e-62], N[Sin[th], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.1 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 3.0999999999999999e-62Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/86.0%
associate-/l*88.0%
unpow288.0%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
if 3.0999999999999999e-62 < kx 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%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 9.0%
expm1-log1p-u9.0%
expm1-undefine26.6%
Applied egg-rr26.6%
expm1-define9.0%
associate-*r/26.3%
*-rgt-identity26.3%
times-frac9.0%
/-rgt-identity9.0%
*-inverses9.0%
*-lft-identity9.0%
Simplified9.0%
expm1-undefine26.6%
log1p-undefine26.6%
rem-exp-log26.6%
+-commutative26.6%
Applied egg-rr26.6%
Taylor expanded in th around 0 23.7%
Final simplification27.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.5e-122) th 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.5e-122) {
tmp = th;
} else {
tmp = 0.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 <= 3.5d-122) then
tmp = th
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.5e-122) {
tmp = th;
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.5e-122: tmp = th else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.5e-122) tmp = th; else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.5e-122) tmp = th; else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.5e-122], th, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.5 \cdot 10^{-122}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 3.5000000000000001e-122Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/85.2%
associate-/l*87.0%
unpow287.0%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
Taylor expanded in th around 0 15.1%
if 3.5000000000000001e-122 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 12.5%
expm1-log1p-u12.5%
expm1-undefine26.9%
Applied egg-rr26.9%
expm1-define12.5%
associate-*r/27.7%
*-rgt-identity27.7%
times-frac12.5%
/-rgt-identity12.5%
*-inverses12.5%
*-lft-identity12.5%
Simplified12.5%
expm1-undefine26.9%
log1p-undefine26.9%
rem-exp-log26.9%
+-commutative26.9%
Applied egg-rr26.9%
Taylor expanded in th around 0 21.1%
Final simplification17.1%
(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 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/89.7%
associate-/l*91.1%
unpow291.1%
Simplified99.6%
Taylor expanded in kx around 0 23.7%
Taylor expanded in th around 0 12.2%
herbie shell --seed 2024090
(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)))