
(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 94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-undefine99.6%
Applied egg-rr99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.125)
(fabs (sin th))
(if (<= (sin ky) 5e-102)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 5e-57) (not (<= (sin ky) 9e-5)))
(sin th)
(/ (* ky (sin th)) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.125) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-102) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 5e-57) || !(sin(ky) <= 9e-5)) {
tmp = sin(th);
} else {
tmp = (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(ky) <= (-0.125d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-102) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 5d-57) .or. (.not. (sin(ky) <= 9d-5))) then
tmp = sin(th)
else
tmp = (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(ky) <= -0.125) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-102) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 5e-57) || !(Math.sin(ky) <= 9e-5)) {
tmp = Math.sin(th);
} else {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.125: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-102: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 5e-57) or not (math.sin(ky) <= 9e-5): tmp = math.sin(th) else: tmp = (ky * math.sin(th)) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.125) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-102) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 5e-57) || !(sin(ky) <= 9e-5)) tmp = sin(th); else tmp = Float64(Float64(ky * sin(th)) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.125) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-102) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 5e-57) || ~((sin(ky) <= 9e-5))) tmp = sin(th); else tmp = (ky * sin(th)) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.125], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-102], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-57], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 9e-5]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.125:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-102}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-57} \lor \neg \left(\sin ky \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.125Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod20.4%
pow220.4%
Applied egg-rr20.4%
unpow220.4%
rem-sqrt-square28.5%
Simplified28.5%
if -0.125 < (sin.f64 ky) < 5.00000000000000026e-102Initial program 89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
associate-*l/86.3%
associate-/l*89.1%
unpow289.1%
Simplified99.5%
Taylor expanded in ky around 0 49.8%
associate-/l*52.2%
Simplified52.2%
if 5.00000000000000026e-102 < (sin.f64 ky) < 5.0000000000000002e-57 or 9.00000000000000057e-5 < (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%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.0%
if 5.0000000000000002e-57 < (sin.f64 ky) < 9.00000000000000057e-5Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in ky around 0 61.0%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.125)
(fabs (sin th))
(if (<= (sin ky) 5e-102)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 5e-57) (not (<= (sin ky) 9e-5)))
(sin th)
(* (sin th) (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.125) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-102) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 5e-57) || !(sin(ky) <= 9e-5)) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.125d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-102) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 5d-57) .or. (.not. (sin(ky) <= 9d-5))) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.125) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-102) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 5e-57) || !(Math.sin(ky) <= 9e-5)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.125: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-102: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 5e-57) or not (math.sin(ky) <= 9e-5): tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.125) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-102) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 5e-57) || !(sin(ky) <= 9e-5)) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.125) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-102) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 5e-57) || ~((sin(ky) <= 9e-5))) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.125], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-102], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-57], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 9e-5]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.125:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-102}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-57} \lor \neg \left(\sin ky \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.125Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod20.4%
pow220.4%
Applied egg-rr20.4%
unpow220.4%
rem-sqrt-square28.5%
Simplified28.5%
if -0.125 < (sin.f64 ky) < 5.00000000000000026e-102Initial program 89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
associate-*l/86.3%
associate-/l*89.1%
unpow289.1%
Simplified99.5%
Taylor expanded in ky around 0 49.8%
associate-/l*52.2%
Simplified52.2%
if 5.00000000000000026e-102 < (sin.f64 ky) < 5.0000000000000002e-57 or 9.00000000000000057e-5 < (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%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.0%
if 5.0000000000000002e-57 < (sin.f64 ky) < 9.00000000000000057e-5Initial program 99.5%
Taylor expanded in ky around 0 61.0%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.125)
(fabs (sin th))
(if (or (<= (sin ky) 5e-102)
(and (not (<= (sin ky) 5e-57)) (<= (sin ky) 9e-5)))
(* ky (/ (sin th) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.125) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 5e-102) || (!(sin(ky) <= 5e-57) && (sin(ky) <= 9e-5))) {
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.125d0)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 5d-102) .or. (.not. (sin(ky) <= 5d-57)) .and. (sin(ky) <= 9d-5)) 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.125) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 5e-102) || (!(Math.sin(ky) <= 5e-57) && (Math.sin(ky) <= 9e-5))) {
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.125: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 5e-102) or (not (math.sin(ky) <= 5e-57) and (math.sin(ky) <= 9e-5)): 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.125) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-102) || (!(sin(ky) <= 5e-57) && (sin(ky) <= 9e-5))) 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.125) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-102) || (~((sin(ky) <= 5e-57)) && (sin(ky) <= 9e-5))) 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.125], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-102], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-57]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 9e-5]]], 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.125:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-102} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-57}\right) \land \sin ky \leq 9 \cdot 10^{-5}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.125Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod20.4%
pow220.4%
Applied egg-rr20.4%
unpow220.4%
rem-sqrt-square28.5%
Simplified28.5%
if -0.125 < (sin.f64 ky) < 5.00000000000000026e-102 or 5.0000000000000002e-57 < (sin.f64 ky) < 9.00000000000000057e-5Initial program 89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
associate-*l/87.4%
associate-/l*89.9%
unpow289.9%
Simplified99.6%
Taylor expanded in ky around 0 50.7%
associate-/l*52.9%
Simplified52.9%
if 5.00000000000000026e-102 < (sin.f64 ky) < 5.0000000000000002e-57 or 9.00000000000000057e-5 < (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%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.0%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(* ky (fabs t_1))
(if (<= (sin kx) 5e-6)
(/ ky (/ (hypot ky kx) (sin th)))
(* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs(t_1);
} else if (sin(kx) <= 5e-6) {
tmp = ky / (hypot(ky, kx) / sin(th));
} else {
tmp = sin(ky) * t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs(t_1);
} else if (Math.sin(kx) <= 5e-6) {
tmp = ky / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs(t_1) elif math.sin(kx) <= 5e-6: tmp = ky / (math.hypot(ky, kx) / math.sin(th)) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(t_1)); elseif (sin(kx) <= 5e-6) tmp = Float64(ky / Float64(hypot(ky, kx) / sin(th))); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs(t_1); elseif (sin(kx) <= 5e-6) tmp = ky / (hypot(ky, kx) / sin(th)); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-6], N[(ky / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.3%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 15.0%
clear-num15.0%
associate-/r/15.0%
Applied egg-rr15.0%
Taylor expanded in ky around 0 16.0%
add-sqr-sqrt8.1%
sqrt-unprod35.0%
pow235.0%
associate-*l/35.0%
*-un-lft-identity35.0%
Applied egg-rr35.0%
unpow235.0%
rem-sqrt-square36.1%
Simplified36.1%
if -0.0200000000000000004 < (sin.f64 kx) < 5.00000000000000041e-6Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/86.6%
associate-/l*89.3%
unpow289.3%
Simplified99.7%
Taylor expanded in kx around 0 98.8%
clear-num98.6%
un-div-inv98.9%
Applied egg-rr98.9%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around 0 69.3%
if 5.00000000000000041e-6 < (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%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 68.9%
(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 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/93.5%
associate-/l*94.8%
unpow294.8%
Simplified99.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(* ky (fabs t_1))
(if (<= (sin kx) 5e-6) (/ ky (/ (hypot ky kx) (sin th))) (* ky t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs(t_1);
} else if (sin(kx) <= 5e-6) {
tmp = ky / (hypot(ky, kx) / sin(th));
} else {
tmp = ky * t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs(t_1);
} else if (Math.sin(kx) <= 5e-6) {
tmp = ky / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = ky * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs(t_1) elif math.sin(kx) <= 5e-6: tmp = ky / (math.hypot(ky, kx) / math.sin(th)) else: tmp = ky * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(t_1)); elseif (sin(kx) <= 5e-6) tmp = Float64(ky / Float64(hypot(ky, kx) / sin(th))); else tmp = Float64(ky * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs(t_1); elseif (sin(kx) <= 5e-6) tmp = ky / (hypot(ky, kx) / sin(th)); else tmp = ky * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-6], N[(ky / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.3%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 15.0%
clear-num15.0%
associate-/r/15.0%
Applied egg-rr15.0%
Taylor expanded in ky around 0 16.0%
add-sqr-sqrt8.1%
sqrt-unprod35.0%
pow235.0%
associate-*l/35.0%
*-un-lft-identity35.0%
Applied egg-rr35.0%
unpow235.0%
rem-sqrt-square36.1%
Simplified36.1%
if -0.0200000000000000004 < (sin.f64 kx) < 5.00000000000000041e-6Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/86.6%
associate-/l*89.3%
unpow289.3%
Simplified99.7%
Taylor expanded in kx around 0 98.8%
clear-num98.6%
un-div-inv98.9%
Applied egg-rr98.9%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around 0 69.3%
if 5.00000000000000041e-6 < (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%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.4%
associate-/l*62.4%
Simplified62.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(fabs (* (sin th) (/ ky (sin kx))))
(if (<= (sin kx) 5e-6)
(/ ky (/ (hypot ky kx) (sin th)))
(* ky (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(kx) <= 5e-6) {
tmp = ky / (hypot(ky, kx) / sin(th));
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-6) {
tmp = ky / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(kx) <= 5e-6: tmp = ky / (math.hypot(ky, kx) / math.sin(th)) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(kx) <= 5e-6) tmp = Float64(ky / Float64(hypot(ky, kx) / sin(th))); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(kx) <= 5e-6) tmp = ky / (hypot(ky, kx) / sin(th)); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-6], N[(ky / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.3%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 15.0%
clear-num15.0%
associate-/r/15.0%
Applied egg-rr15.0%
Taylor expanded in ky around 0 16.0%
add-sqr-sqrt13.8%
sqrt-unprod20.1%
pow220.1%
associate-*r*20.1%
*-commutative20.1%
un-div-inv20.1%
Applied egg-rr20.1%
unpow220.1%
rem-sqrt-square32.0%
Simplified32.0%
if -0.0200000000000000004 < (sin.f64 kx) < 5.00000000000000041e-6Initial program 89.5%
unpow289.5%
sqr-neg89.5%
sin-neg89.5%
sin-neg89.5%
unpow289.5%
associate-*l/86.6%
associate-/l*89.3%
unpow289.3%
Simplified99.7%
Taylor expanded in kx around 0 98.8%
clear-num98.6%
un-div-inv98.9%
Applied egg-rr98.9%
Taylor expanded in ky around 0 45.1%
Taylor expanded in ky around 0 69.3%
if 5.00000000000000041e-6 < (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%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.4%
associate-/l*62.4%
Simplified62.4%
(FPCore (kx ky th) :precision binary64 (if (<= th 1.22e-5) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.22e-5) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.22e-5) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.22e-5: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.22e-5) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.22e-5) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.22e-5], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.22 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 1.22000000000000001e-5Initial program 95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 67.2%
if 1.22000000000000001e-5 < th Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/94.4%
associate-/l*94.3%
unpow294.3%
Simplified99.5%
associate-*r/99.5%
hypot-undefine94.4%
unpow294.4%
unpow294.4%
+-commutative94.4%
associate-*l/94.5%
*-commutative94.5%
clear-num94.4%
un-div-inv94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.6%
Taylor expanded in ky around 0 69.5%
(FPCore (kx ky th) :precision binary64 (if (<= th 5e-6) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 5e-6) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 5e-6) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 5e-6: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 5e-6) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 5e-6) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 5e-6], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 5.00000000000000041e-6Initial program 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/93.2%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
Taylor expanded in th around 0 67.1%
if 5.00000000000000041e-6 < th Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/94.4%
associate-/l*94.3%
unpow294.3%
Simplified99.5%
associate-*r/99.5%
hypot-undefine94.4%
unpow294.4%
unpow294.4%
+-commutative94.4%
associate-*l/94.5%
*-commutative94.5%
clear-num94.4%
un-div-inv94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.6%
Taylor expanded in ky around 0 69.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.04) (/ (sin ky) (/ (hypot (sin ky) kx) th)) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.04) {
tmp = sin(ky) / (hypot(sin(ky), kx) / th);
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.04) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / th);
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.04: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / th) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.04) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / th)); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.04) tmp = sin(ky) / (hypot(sin(ky), kx) / th); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.04:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 62.6%
clear-num62.5%
un-div-inv62.6%
Applied egg-rr62.6%
Taylor expanded in th around 0 29.3%
associate-*l/29.4%
+-commutative29.4%
unpow229.4%
unpow229.4%
hypot-undefine29.6%
*-lft-identity29.6%
Simplified29.6%
if -0.0400000000000000008 < (sin.f64 ky) Initial program 93.3%
unpow293.3%
sqr-neg93.3%
sin-neg93.3%
sin-neg93.3%
unpow293.3%
associate-*l/91.7%
associate-/l*93.3%
unpow293.3%
Simplified99.6%
associate-*r/97.5%
hypot-undefine91.7%
unpow291.7%
unpow291.7%
+-commutative91.7%
associate-*l/93.3%
*-commutative93.3%
clear-num93.2%
un-div-inv93.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 67.0%
Taylor expanded in ky around 0 76.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 5e-6) (/ ky (/ (hypot ky kx) (sin th))) (* ky (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 5e-6) {
tmp = ky / (hypot(ky, kx) / sin(th));
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 5e-6) {
tmp = ky / (Math.hypot(ky, kx) / Math.sin(th));
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 5e-6: tmp = ky / (math.hypot(ky, kx) / math.sin(th)) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 5e-6) tmp = Float64(ky / Float64(hypot(ky, kx) / sin(th))); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 5e-6) tmp = ky / (hypot(ky, kx) / sin(th)); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-6], N[(ky / N[(N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(ky, kx\right)}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 5.00000000000000041e-6Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.3%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
Taylor expanded in kx around 0 69.1%
clear-num68.9%
un-div-inv69.1%
Applied egg-rr69.1%
Taylor expanded in ky around 0 34.9%
Taylor expanded in ky around 0 50.6%
if 5.00000000000000041e-6 < (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%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.4%
associate-/l*62.4%
Simplified62.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.8e-155) (* ky (/ (sin th) kx)) (if (or (<= ky 5.2e+46) (not (<= ky 5.6e+145))) (sin th) (fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.8e-155) {
tmp = ky * (sin(th) / kx);
} else if ((ky <= 5.2e+46) || !(ky <= 5.6e+145)) {
tmp = sin(th);
} else {
tmp = fabs(sin(th));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 5.8d-155) then
tmp = ky * (sin(th) / kx)
else if ((ky <= 5.2d+46) .or. (.not. (ky <= 5.6d+145))) then
tmp = sin(th)
else
tmp = abs(sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.8e-155) {
tmp = ky * (Math.sin(th) / kx);
} else if ((ky <= 5.2e+46) || !(ky <= 5.6e+145)) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.8e-155: tmp = ky * (math.sin(th) / kx) elif (ky <= 5.2e+46) or not (ky <= 5.6e+145): tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.8e-155) tmp = Float64(ky * Float64(sin(th) / kx)); elseif ((ky <= 5.2e+46) || !(ky <= 5.6e+145)) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5.8e-155) tmp = ky * (sin(th) / kx); elseif ((ky <= 5.2e+46) || ~((ky <= 5.6e+145))) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.8e-155], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 5.2e+46], N[Not[LessEqual[ky, 5.6e+145]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.8 \cdot 10^{-155}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 5.2 \cdot 10^{+46} \lor \neg \left(ky \leq 5.6 \cdot 10^{+145}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 5.80000000000000021e-155Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/90.4%
associate-/l*91.8%
unpow291.8%
Simplified99.6%
Taylor expanded in kx around 0 54.0%
Taylor expanded in ky around 0 18.5%
associate-/l*19.7%
Simplified19.7%
if 5.80000000000000021e-155 < ky < 5.20000000000000027e46 or 5.5999999999999997e145 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 38.0%
if 5.20000000000000027e46 < ky < 5.5999999999999997e145Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.2%
Taylor expanded in kx around 0 22.6%
add-sqr-sqrt7.7%
sqrt-unprod14.0%
pow214.0%
Applied egg-rr14.0%
unpow214.0%
rem-sqrt-square14.6%
Simplified14.6%
Final simplification24.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6e-155) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-155) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 6d-155) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-155) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-155: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-155) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-155) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-155], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-155}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.99999999999999967e-155Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/90.4%
associate-/l*91.8%
unpow291.8%
Simplified99.6%
Taylor expanded in kx around 0 54.0%
Taylor expanded in ky around 0 18.5%
associate-/l*19.7%
Simplified19.7%
if 5.99999999999999967e-155 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 34.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.22e+24) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.22e+24) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.22d+24) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.22e+24) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.22e+24: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.22e+24) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.22e+24) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.22e+24], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.22 \cdot 10^{+24}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.21999999999999996e24Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.5%
associate-/l*93.2%
unpow293.2%
Simplified99.6%
Taylor expanded in kx around 0 27.2%
if 1.21999999999999996e24 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 44.5%
clear-num44.4%
associate-/r/44.5%
Applied egg-rr44.5%
Taylor expanded in ky around 0 42.0%
Taylor expanded in th around 0 27.3%
associate-/l*27.3%
Simplified27.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.2e-155) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.2e-155) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 5.2d-155) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.2e-155) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.2e-155: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.2e-155) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5.2e-155) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.2e-155], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.2 \cdot 10^{-155}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.20000000000000016e-155Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/90.4%
associate-/l*91.8%
unpow291.8%
Simplified99.6%
Taylor expanded in kx around 0 54.0%
Taylor expanded in ky around 0 18.5%
associate-/l*19.7%
Simplified19.7%
Taylor expanded in th around 0 15.1%
associate-/l*16.2%
Simplified16.2%
if 5.20000000000000016e-155 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 34.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.4e-103) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.4e-103) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.4d-103) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.4e-103) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.4e-103: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.4e-103) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.4e-103) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.4e-103], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.4 \cdot 10^{-103}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 3.40000000000000003e-103Initial program 92.5%
unpow292.5%
sqr-neg92.5%
sin-neg92.5%
sin-neg92.5%
unpow292.5%
associate-*l/90.6%
associate-/l*92.4%
unpow292.4%
Simplified99.6%
Taylor expanded in kx around 0 54.4%
Taylor expanded in ky around 0 19.2%
associate-/l*20.8%
Simplified20.8%
Taylor expanded in th around 0 16.1%
associate-/l*17.6%
Simplified17.6%
if 3.40000000000000003e-103 < 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%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 36.5%
Taylor expanded in th around 0 17.3%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/93.5%
associate-/l*94.8%
unpow294.8%
Simplified99.5%
Taylor expanded in kx around 0 22.5%
Taylor expanded in th around 0 11.3%
herbie shell --seed 2024110
(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)))