
(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 12 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) (/ (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/92.9%
associate-/l*94.9%
+-commutative94.9%
unpow294.9%
sin-neg94.9%
sin-neg94.9%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.16)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 2e-148)
(* (sin th) (/ (sin ky) (sin kx)))
(if (or (<= (sin ky) 2e-117) (not (<= (sin ky) 5e-64)))
(sin th)
(* ky (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.16) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 2e-148) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if ((sin(ky) <= 2e-117) || !(sin(ky) <= 5e-64)) {
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.16d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 2d-148) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if ((sin(ky) <= 2d-117) .or. (.not. (sin(ky) <= 5d-64))) 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.16) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-148) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if ((Math.sin(ky) <= 2e-117) || !(Math.sin(ky) <= 5e-64)) {
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.16: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 2e-148: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif (math.sin(ky) <= 2e-117) or not (math.sin(ky) <= 5e-64): 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.16) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 2e-148) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif ((sin(ky) <= 2e-117) || !(sin(ky) <= 5e-64)) tmp = 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(ky) <= -0.16) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 2e-148) tmp = sin(th) * (sin(ky) / sin(kx)); elseif ((sin(ky) <= 2e-117) || ~((sin(ky) <= 5e-64))) 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.16], 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], 2e-148], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 2e-117], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-64]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.16:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-148}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-117} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-64}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.160000000000000003Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.7%
Taylor expanded in kx around 0 3.6%
add-sqr-sqrt2.2%
sqrt-unprod25.0%
pow225.0%
Applied egg-rr25.0%
unpow225.0%
rem-sqrt-square34.0%
Simplified34.0%
if -0.160000000000000003 < (sin.f64 ky) < 1.99999999999999987e-148Initial program 87.3%
+-commutative87.3%
unpow287.3%
unpow287.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 54.6%
if 1.99999999999999987e-148 < (sin.f64 ky) < 2.00000000000000006e-117 or 5.00000000000000033e-64 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.0%
if 2.00000000000000006e-117 < (sin.f64 ky) < 5.00000000000000033e-64Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/94.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in ky around 0 38.5%
associate-/l*38.3%
Simplified38.3%
Final simplification48.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 0.0005)
(/ (* ky (sin th)) (hypot (sin ky) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 0.0005) {
tmp = (ky * sin(th)) / 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.05) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 0.0005) {
tmp = (ky * Math.sin(th)) / 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.05: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 0.0005: tmp = (ky * math.sin(th)) / 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.05) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 0.0005) tmp = Float64(Float64(ky * sin(th)) / 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.05) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 0.0005) tmp = (ky * sin(th)) / 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.05], 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], 0.0005], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.7%
Taylor expanded in kx around 0 3.7%
add-sqr-sqrt2.2%
sqrt-unprod25.3%
pow225.3%
Applied egg-rr25.3%
unpow225.3%
rem-sqrt-square35.1%
Simplified35.1%
if -0.050000000000000003 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/86.5%
associate-/l*90.5%
+-commutative90.5%
unpow290.5%
sin-neg90.5%
sin-neg90.5%
Simplified99.7%
associate-*r/93.1%
*-commutative93.1%
Applied egg-rr93.1%
Taylor expanded in ky around 0 91.9%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 61.3%
Final simplification70.0%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin ky) (sin kx)))) (if (<= ky 0.9) (/ (* ky (sin th)) t_1) (/ (* (sin ky) th) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (ky <= 0.9) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = (sin(ky) * th) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (ky <= 0.9) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = (Math.sin(ky) * th) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if ky <= 0.9: tmp = (ky * math.sin(th)) / t_1 else: tmp = (math.sin(ky) * th) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (ky <= 0.9) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = Float64(Float64(sin(ky) * th) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (ky <= 0.9) tmp = (ky * sin(th)) / t_1; else tmp = (sin(ky) * th) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[ky, 0.9], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;ky \leq 0.9:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot th}{t\_1}\\
\end{array}
\end{array}
if ky < 0.900000000000000022Initial program 93.3%
unpow293.3%
sqr-neg93.3%
sin-neg93.3%
sin-neg93.3%
unpow293.3%
associate-*l/90.6%
associate-/l*93.3%
+-commutative93.3%
unpow293.3%
sin-neg93.3%
sin-neg93.3%
Simplified99.7%
associate-*r/95.1%
*-commutative95.1%
Applied egg-rr95.1%
Taylor expanded in ky around 0 64.7%
if 0.900000000000000022 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
associate-*r/99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 57.3%
Final simplification62.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.2e-68) (sin th) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.2e-68) {
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.2d-68) 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.2e-68) {
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.2e-68: 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.2e-68) 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.2e-68) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.2e-68], 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.2 \cdot 10^{-68}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 2.20000000000000002e-68Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/90.5%
associate-/l*92.9%
+-commutative92.9%
unpow292.9%
sin-neg92.9%
sin-neg92.9%
Simplified99.7%
Taylor expanded in kx around 0 29.1%
if 2.20000000000000002e-68 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in ky around 0 44.2%
Final simplification33.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (/ (sin th) (sin kx)))))
(if (<= ky 5.8e-148)
t_1
(if (<= ky 1.5e-117)
(sin th)
(if (<= ky 5.5e-64)
t_1
(if (<= ky 2.1e+37) (sin th) (fabs (sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = ky * (sin(th) / sin(kx));
double tmp;
if (ky <= 5.8e-148) {
tmp = t_1;
} else if (ky <= 1.5e-117) {
tmp = sin(th);
} else if (ky <= 5.5e-64) {
tmp = t_1;
} else if (ky <= 2.1e+37) {
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) :: t_1
real(8) :: tmp
t_1 = ky * (sin(th) / sin(kx))
if (ky <= 5.8d-148) then
tmp = t_1
else if (ky <= 1.5d-117) then
tmp = sin(th)
else if (ky <= 5.5d-64) then
tmp = t_1
else if (ky <= 2.1d+37) 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 t_1 = ky * (Math.sin(th) / Math.sin(kx));
double tmp;
if (ky <= 5.8e-148) {
tmp = t_1;
} else if (ky <= 1.5e-117) {
tmp = Math.sin(th);
} else if (ky <= 5.5e-64) {
tmp = t_1;
} else if (ky <= 2.1e+37) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * (math.sin(th) / math.sin(kx)) tmp = 0 if ky <= 5.8e-148: tmp = t_1 elif ky <= 1.5e-117: tmp = math.sin(th) elif ky <= 5.5e-64: tmp = t_1 elif ky <= 2.1e+37: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) t_1 = Float64(ky * Float64(sin(th) / sin(kx))) tmp = 0.0 if (ky <= 5.8e-148) tmp = t_1; elseif (ky <= 1.5e-117) tmp = sin(th); elseif (ky <= 5.5e-64) tmp = t_1; elseif (ky <= 2.1e+37) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky * (sin(th) / sin(kx)); tmp = 0.0; if (ky <= 5.8e-148) tmp = t_1; elseif (ky <= 1.5e-117) tmp = sin(th); elseif (ky <= 5.5e-64) tmp = t_1; elseif (ky <= 2.1e+37) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 5.8e-148], t$95$1, If[LessEqual[ky, 1.5e-117], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 5.5e-64], t$95$1, If[LessEqual[ky, 2.1e+37], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{if}\;ky \leq 5.8 \cdot 10^{-148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.5 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+37}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 5.7999999999999997e-148 or 1.49999999999999996e-117 < ky < 5.4999999999999999e-64Initial program 92.6%
unpow292.6%
sqr-neg92.6%
sin-neg92.6%
sin-neg92.6%
unpow292.6%
associate-*l/90.1%
associate-/l*92.6%
+-commutative92.6%
unpow292.6%
sin-neg92.6%
sin-neg92.6%
Simplified99.7%
Taylor expanded in ky around 0 35.3%
associate-/l*36.0%
Simplified36.0%
if 5.7999999999999997e-148 < ky < 1.49999999999999996e-117 or 5.4999999999999999e-64 < ky < 2.1000000000000001e37Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/95.3%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 44.6%
if 2.1000000000000001e37 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.7%
Taylor expanded in kx around 0 23.9%
add-sqr-sqrt6.2%
sqrt-unprod13.6%
pow213.6%
Applied egg-rr13.6%
unpow213.6%
rem-sqrt-square22.4%
associate-*r/22.4%
*-rgt-identity22.4%
times-frac22.4%
*-inverses22.4%
/-rgt-identity22.4%
*-lft-identity22.4%
Simplified22.4%
Final simplification33.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 5.5e-148)
(* (sin th) (/ ky (sin kx)))
(if (<= ky 1.42e-117)
(sin th)
(if (<= ky 4.7e-64)
(* ky (/ (sin th) (sin kx)))
(if (<= ky 2.1e+37) (sin th) (fabs (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.5e-148) {
tmp = sin(th) * (ky / sin(kx));
} else if (ky <= 1.42e-117) {
tmp = sin(th);
} else if (ky <= 4.7e-64) {
tmp = ky * (sin(th) / sin(kx));
} else if (ky <= 2.1e+37) {
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.5d-148) then
tmp = sin(th) * (ky / sin(kx))
else if (ky <= 1.42d-117) then
tmp = sin(th)
else if (ky <= 4.7d-64) then
tmp = ky * (sin(th) / sin(kx))
else if (ky <= 2.1d+37) 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.5e-148) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (ky <= 1.42e-117) {
tmp = Math.sin(th);
} else if (ky <= 4.7e-64) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (ky <= 2.1e+37) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.5e-148: tmp = math.sin(th) * (ky / math.sin(kx)) elif ky <= 1.42e-117: tmp = math.sin(th) elif ky <= 4.7e-64: tmp = ky * (math.sin(th) / math.sin(kx)) elif ky <= 2.1e+37: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.5e-148) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (ky <= 1.42e-117) tmp = sin(th); elseif (ky <= 4.7e-64) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (ky <= 2.1e+37) 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.5e-148) tmp = sin(th) * (ky / sin(kx)); elseif (ky <= 1.42e-117) tmp = sin(th); elseif (ky <= 4.7e-64) tmp = ky * (sin(th) / sin(kx)); elseif (ky <= 2.1e+37) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.5e-148], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.42e-117], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 4.7e-64], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.1e+37], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.5 \cdot 10^{-148}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 1.42 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4.7 \cdot 10^{-64}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+37}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 5.5000000000000003e-148Initial program 91.7%
+-commutative91.7%
unpow291.7%
unpow291.7%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.7%
if 5.5000000000000003e-148 < ky < 1.42000000000000001e-117 or 4.6999999999999998e-64 < ky < 2.1000000000000001e37Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/95.3%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 44.6%
if 1.42000000000000001e-117 < ky < 4.6999999999999998e-64Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/94.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in ky around 0 38.5%
associate-/l*38.3%
Simplified38.3%
if 2.1000000000000001e37 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.7%
Taylor expanded in kx around 0 23.9%
add-sqr-sqrt6.2%
sqrt-unprod13.6%
pow213.6%
Applied egg-rr13.6%
unpow213.6%
rem-sqrt-square22.4%
associate-*r/22.4%
*-rgt-identity22.4%
times-frac22.4%
*-inverses22.4%
/-rgt-identity22.4%
*-lft-identity22.4%
Simplified22.4%
Final simplification33.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.4e-98) (+ (+ (sin th) 1.0) -1.0) (if (<= ky 2.1e+37) (sin th) (fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.4e-98) {
tmp = (sin(th) + 1.0) + -1.0;
} else if (ky <= 2.1e+37) {
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 <= 4.4d-98) then
tmp = (sin(th) + 1.0d0) + (-1.0d0)
else if (ky <= 2.1d+37) 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 <= 4.4e-98) {
tmp = (Math.sin(th) + 1.0) + -1.0;
} else if (ky <= 2.1e+37) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.4e-98: tmp = (math.sin(th) + 1.0) + -1.0 elif ky <= 2.1e+37: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.4e-98) tmp = Float64(Float64(sin(th) + 1.0) + -1.0); elseif (ky <= 2.1e+37) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.4e-98) tmp = (sin(th) + 1.0) + -1.0; elseif (ky <= 2.1e+37) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.4e-98], N[(N[(N[Sin[th], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[ky, 2.1e+37], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.4 \cdot 10^{-98}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+37}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 4.39999999999999993e-98Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.2%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.7%
Taylor expanded in kx around 0 21.5%
expm1-log1p-u21.4%
expm1-undefine26.3%
Applied egg-rr26.3%
expm1-define21.4%
associate-*r/31.1%
*-rgt-identity31.1%
times-frac21.4%
*-inverses21.4%
/-rgt-identity21.4%
*-lft-identity21.4%
Simplified21.4%
expm1-undefine26.3%
log1p-undefine26.3%
rem-exp-log26.3%
+-commutative26.3%
Applied egg-rr26.3%
if 4.39999999999999993e-98 < ky < 2.1000000000000001e37Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in kx around 0 32.6%
if 2.1000000000000001e37 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.7%
Taylor expanded in kx around 0 23.9%
add-sqr-sqrt6.2%
sqrt-unprod13.6%
pow213.6%
Applied egg-rr13.6%
unpow213.6%
rem-sqrt-square22.4%
associate-*r/22.4%
*-rgt-identity22.4%
times-frac22.4%
*-inverses22.4%
/-rgt-identity22.4%
*-lft-identity22.4%
Simplified22.4%
Final simplification26.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.5e-67) (sin th) (+ (+ (sin th) 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.5e-67) {
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 <= 2.5d-67) 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 <= 2.5e-67) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.5e-67: 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 <= 2.5e-67) 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 <= 2.5e-67) tmp = sin(th); else tmp = (sin(th) + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.5e-67], 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 2.5 \cdot 10^{-67}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 2.4999999999999999e-67Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/90.5%
associate-/l*92.9%
+-commutative92.9%
unpow292.9%
sin-neg92.9%
sin-neg92.9%
Simplified99.7%
Taylor expanded in kx around 0 29.1%
if 2.4999999999999999e-67 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.4%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 10.0%
expm1-log1p-u10.0%
expm1-undefine18.7%
Applied egg-rr18.7%
expm1-define10.0%
associate-*r/19.9%
*-rgt-identity19.9%
times-frac10.0%
*-inverses10.0%
/-rgt-identity10.0%
*-lft-identity10.0%
Simplified10.0%
expm1-undefine18.7%
log1p-undefine18.7%
rem-exp-log18.7%
+-commutative18.7%
Applied egg-rr18.7%
Final simplification25.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6e-208) (* -0.0001984126984126984 (pow th 7.0)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-208) {
tmp = -0.0001984126984126984 * pow(th, 7.0);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 6d-208) then
tmp = (-0.0001984126984126984d0) * (th ** 7.0d0)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-208) {
tmp = -0.0001984126984126984 * Math.pow(th, 7.0);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-208: tmp = -0.0001984126984126984 * math.pow(th, 7.0) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-208) tmp = Float64(-0.0001984126984126984 * (th ^ 7.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-208) tmp = -0.0001984126984126984 * (th ^ 7.0); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-208], N[(-0.0001984126984126984 * N[Power[th, 7.0], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-208}:\\
\;\;\;\;-0.0001984126984126984 \cdot {th}^{7}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.99999999999999972e-208Initial program 94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
associate-*l/91.9%
associate-/l*94.3%
+-commutative94.3%
unpow294.3%
sin-neg94.3%
sin-neg94.3%
Simplified99.7%
Taylor expanded in kx around 0 16.5%
Taylor expanded in th around 0 9.2%
Taylor expanded in th around inf 15.1%
if 5.99999999999999972e-208 < ky Initial program 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/93.9%
associate-/l*95.5%
+-commutative95.5%
unpow295.5%
sin-neg95.5%
sin-neg95.5%
Simplified99.6%
Taylor expanded in kx around 0 31.3%
Final simplification22.6%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/92.9%
associate-/l*94.9%
+-commutative94.9%
unpow294.9%
sin-neg94.9%
sin-neg94.9%
Simplified99.7%
Taylor expanded in kx around 0 23.3%
Final simplification23.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/92.9%
associate-/l*94.9%
+-commutative94.9%
unpow294.9%
sin-neg94.9%
sin-neg94.9%
Simplified99.7%
Taylor expanded in kx around 0 23.3%
Taylor expanded in th around 0 13.2%
Final simplification13.2%
herbie shell --seed 2024076
(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)))