
(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 19 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 th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.7%
associate-/l*93.9%
unpow293.9%
Simplified99.6%
associate-*r/97.3%
hypot-undefine93.7%
unpow293.7%
unpow293.7%
+-commutative93.7%
associate-*l/93.9%
*-commutative93.9%
clear-num93.9%
un-div-inv94.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-undefine99.6%
Applied egg-rr99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ 1.0 (sin ky))))
(if (<= (sin kx) -0.02)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin kx) 1e-134)
(sin th)
(if (<= (sin kx) 5e-79)
(/ (* (sin th) ky) (hypot (sin ky) kx))
(if (<= (sin kx) 5e-56)
(/ t_1 (/ t_1 (sin th)))
(* (sin ky) (/ (sin th) (sin kx)))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 / sin(ky);
double tmp;
if (sin(kx) <= -0.02) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= 1e-134) {
tmp = sin(th);
} else if (sin(kx) <= 5e-79) {
tmp = (sin(th) * ky) / hypot(sin(ky), kx);
} else if (sin(kx) <= 5e-56) {
tmp = t_1 / (t_1 / sin(th));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = 1.0 / Math.sin(ky);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= 1e-134) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-79) {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), kx);
} else if (Math.sin(kx) <= 5e-56) {
tmp = t_1 / (t_1 / Math.sin(th));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = 1.0 / math.sin(ky) tmp = 0 if math.sin(kx) <= -0.02: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= 1e-134: tmp = math.sin(th) elif math.sin(kx) <= 5e-79: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), kx) elif math.sin(kx) <= 5e-56: tmp = t_1 / (t_1 / math.sin(th)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) t_1 = Float64(1.0 / sin(ky)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-134) tmp = sin(th); elseif (sin(kx) <= 5e-79) tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), kx)); elseif (sin(kx) <= 5e-56) tmp = Float64(t_1 / Float64(t_1 / sin(th))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = 1.0 / sin(ky); tmp = 0.0; if (sin(kx) <= -0.02) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= 1e-134) tmp = sin(th); elseif (sin(kx) <= 5e-79) tmp = (sin(th) * ky) / hypot(sin(ky), kx); elseif (sin(kx) <= 5e-56) tmp = t_1 / (t_1 / sin(th)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-134], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-79], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-56], N[(t$95$1 / N[(t$95$1 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\sin ky}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-134}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-79}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\frac{t\_1}{\frac{t\_1}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
Taylor expanded in th around 0 26.2%
if -0.0200000000000000004 < (sin.f64 kx) < 1.00000000000000004e-134Initial program 85.3%
unpow285.3%
sqr-neg85.3%
sin-neg85.3%
sin-neg85.3%
unpow285.3%
associate-*l/84.6%
associate-/l*85.1%
unpow285.1%
Simplified99.7%
Taylor expanded in kx around 0 44.0%
if 1.00000000000000004e-134 < (sin.f64 kx) < 4.99999999999999999e-79Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.3%
associate-/l*99.7%
unpow299.7%
Simplified99.8%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 57.1%
Taylor expanded in kx around 0 57.1%
if 4.99999999999999999e-79 < (sin.f64 kx) < 4.99999999999999997e-56Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.8%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in kx around 0 52.3%
add-log-exp26.9%
Applied egg-rr26.9%
rem-log-exp52.3%
*-un-lft-identity52.3%
associate-*r/63.8%
*-commutative63.8%
*-un-lft-identity63.8%
clear-num63.6%
div-inv63.6%
associate-/r*63.6%
*-un-lft-identity63.6%
*-commutative63.6%
associate-/r*63.8%
*-un-lft-identity63.8%
Applied egg-rr63.8%
if 4.99999999999999997e-56 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 57.3%
Final simplification43.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin kx) 1e-134)
(sin th)
(if (<= (sin kx) 5e-79)
(/ (* (sin th) ky) (hypot (sin ky) kx))
(if (<= (sin kx) 5e-56)
(/ (* (sin th) (sin ky)) (sin ky))
(* (sin ky) (/ (sin th) (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= 1e-134) {
tmp = sin(th);
} else if (sin(kx) <= 5e-79) {
tmp = (sin(th) * ky) / hypot(sin(ky), kx);
} else if (sin(kx) <= 5e-56) {
tmp = (sin(th) * sin(ky)) / sin(ky);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= 1e-134) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-79) {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), kx);
} else if (Math.sin(kx) <= 5e-56) {
tmp = (Math.sin(th) * Math.sin(ky)) / Math.sin(ky);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= 1e-134: tmp = math.sin(th) elif math.sin(kx) <= 5e-79: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), kx) elif math.sin(kx) <= 5e-56: tmp = (math.sin(th) * math.sin(ky)) / math.sin(ky) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-134) tmp = sin(th); elseif (sin(kx) <= 5e-79) tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), kx)); elseif (sin(kx) <= 5e-56) tmp = Float64(Float64(sin(th) * sin(ky)) / sin(ky)); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= 1e-134) tmp = sin(th); elseif (sin(kx) <= 5e-79) tmp = (sin(th) * ky) / hypot(sin(ky), kx); elseif (sin(kx) <= 5e-56) tmp = (sin(th) * sin(ky)) / sin(ky); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-134], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-79], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-56], N[(N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-134}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-79}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\frac{\sin th \cdot \sin ky}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
Taylor expanded in th around 0 26.2%
if -0.0200000000000000004 < (sin.f64 kx) < 1.00000000000000004e-134Initial program 85.3%
unpow285.3%
sqr-neg85.3%
sin-neg85.3%
sin-neg85.3%
unpow285.3%
associate-*l/84.6%
associate-/l*85.1%
unpow285.1%
Simplified99.7%
Taylor expanded in kx around 0 44.0%
if 1.00000000000000004e-134 < (sin.f64 kx) < 4.99999999999999999e-79Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.3%
associate-/l*99.7%
unpow299.7%
Simplified99.8%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 57.1%
Taylor expanded in kx around 0 57.1%
if 4.99999999999999999e-79 < (sin.f64 kx) < 4.99999999999999997e-56Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.8%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in kx around 0 52.3%
associate-*r/63.8%
*-commutative63.8%
Applied egg-rr63.8%
if 4.99999999999999997e-56 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 57.3%
Final simplification43.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-158)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-53)
(/ (* (sin th) ky) (hypot (sin ky) kx))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-158) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-53) {
tmp = (sin(th) * ky) / hypot(sin(ky), kx);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-158) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-53) {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-158: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-53: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-158) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-53) tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-158) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-53) tmp = (sin(th) * ky) / hypot(sin(ky), kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], 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-158], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-53], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-158}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-53}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.6%
sqrt-unprod21.9%
pow221.9%
Applied egg-rr21.9%
unpow221.9%
rem-sqrt-square27.5%
Simplified27.5%
if -0.0100000000000000002 < (sin.f64 ky) < 1.00000000000000006e-158Initial program 84.0%
unpow284.0%
sqr-neg84.0%
sin-neg84.0%
sin-neg84.0%
unpow284.0%
associate-*l/83.4%
associate-/l*84.1%
unpow284.1%
Simplified99.6%
Taylor expanded in ky around 0 45.7%
if 1.00000000000000006e-158 < (sin.f64 ky) < 1.00000000000000003e-53Initial program 98.8%
unpow298.8%
sqr-neg98.8%
sin-neg98.8%
sin-neg98.8%
unpow298.8%
associate-*l/98.9%
associate-/l*99.0%
unpow299.0%
Simplified99.5%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 99.5%
Taylor expanded in kx around 0 55.1%
if 1.00000000000000003e-53 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 60.0%
Final simplification46.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(/ (* th (sin ky)) t_1)
(if (<= (sin ky) 0.0002) (* ky (/ (sin th) t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = (th * sin(ky)) / t_1;
} else if (sin(ky) <= 0.0002) {
tmp = ky * (sin(th) / t_1);
} else {
tmp = sin(th);
}
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 (Math.sin(ky) <= -0.01) {
tmp = (th * Math.sin(ky)) / t_1;
} else if (Math.sin(ky) <= 0.0002) {
tmp = ky * (Math.sin(th) / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = (th * math.sin(ky)) / t_1 elif math.sin(ky) <= 0.0002: tmp = ky * (math.sin(th) / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(Float64(th * sin(ky)) / t_1); elseif (sin(ky) <= 0.0002) tmp = Float64(ky * Float64(sin(th) / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = (th * sin(ky)) / t_1; elseif (sin(ky) <= 0.0002) tmp = ky * (sin(th) / t_1); else tmp = sin(th); 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[N[Sin[ky], $MachinePrecision], -0.01], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0002], N[(ky * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{th \cdot \sin ky}{t\_1}\\
\mathbf{elif}\;\sin ky \leq 0.0002:\\
\;\;\;\;ky \cdot \frac{\sin th}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 51.5%
if -0.0100000000000000002 < (sin.f64 ky) < 2.0000000000000001e-4Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/87.2%
associate-/l*87.7%
unpow287.7%
Simplified99.6%
associate-*r/94.7%
Applied egg-rr94.7%
Taylor expanded in ky around 0 94.4%
associate-/l*99.2%
*-commutative99.2%
Applied egg-rr99.2%
if 2.0000000000000001e-4 < (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.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 60.2%
Final simplification76.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(* ky (/ (sin th) (hypot (sin ky) (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * (sin(th) / hypot(sin(ky), sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * Float64(sin(th) / hypot(sin(ky), sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * (sin(th) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
associate-/l*47.9%
*-commutative47.9%
Applied egg-rr47.9%
if -0.0200000000000000004 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 88.7%
+-commutative88.7%
unpow288.7%
unpow288.7%
hypot-undefine99.9%
Applied egg-rr99.9%
Taylor expanded in kx around 0 99.9%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 60.4%
Final simplification76.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
*-commutative47.8%
associate-/l*47.7%
Applied egg-rr47.7%
if -0.0200000000000000004 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 88.7%
+-commutative88.7%
unpow288.7%
unpow288.7%
hypot-undefine99.9%
Applied egg-rr99.9%
Taylor expanded in kx around 0 99.9%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 60.4%
Final simplification76.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) 2e-301)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin ky) (/ (sin th) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 2e-301) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 2e-301) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 2e-301: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 2e-301) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 2e-301) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-301], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 2 \cdot 10^{-301}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 2.00000000000000013e-301Initial program 92.2%
unpow292.2%
sqr-neg92.2%
sin-neg92.2%
sin-neg92.2%
unpow292.2%
associate-*l/91.8%
associate-/l*92.2%
unpow292.2%
Simplified99.6%
associate-*r/96.7%
Applied egg-rr96.7%
Taylor expanded in ky around 0 49.1%
*-commutative49.1%
associate-/l*51.8%
Applied egg-rr51.8%
if 2.00000000000000013e-301 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/92.6%
associate-/l*92.8%
unpow292.8%
Simplified99.7%
Taylor expanded in kx around 0 99.7%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 60.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.035)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin kx) 1e-6)
(* (sin ky) (/ (sin th) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.035) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= 1e-6) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.035) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.035: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= 1e-6: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.035) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.035) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= 1e-6) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.035], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.035:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.035000000000000003Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 47.8%
Taylor expanded in th around 0 26.2%
if -0.035000000000000003 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 88.7%
unpow288.7%
sqr-neg88.7%
sin-neg88.7%
sin-neg88.7%
unpow288.7%
associate-*l/88.0%
associate-/l*88.5%
unpow288.5%
Simplified99.7%
Taylor expanded in kx around 0 99.7%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 60.4%
Final simplification70.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -2.2e-118) (/ (* th ky) (hypot (sin ky) (sin kx))) (if (<= (sin kx) 4e-56) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -2.2e-118) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= 4e-56) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -2.2e-118) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= 4e-56) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -2.2e-118: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= 4e-56: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -2.2e-118) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 4e-56) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -2.2e-118) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= 4e-56) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -2.2e-118], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-56], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -2.2 \cdot 10^{-118}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-56}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -2.19999999999999984e-118Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 48.2%
Taylor expanded in th around 0 26.7%
if -2.19999999999999984e-118 < (sin.f64 kx) < 4.0000000000000002e-56Initial program 83.5%
unpow283.5%
sqr-neg83.5%
sin-neg83.5%
sin-neg83.5%
unpow283.5%
associate-*l/82.7%
associate-/l*83.4%
unpow283.4%
Simplified99.8%
Taylor expanded in kx around 0 46.3%
if 4.0000000000000002e-56 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 57.3%
Final simplification41.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.165) (sqrt (- 0.5 (/ (cos (* th 2.0)) 2.0))) (if (<= (sin ky) 1e-53) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.165) {
tmp = sqrt((0.5 - (cos((th * 2.0)) / 2.0)));
} else if (sin(ky) <= 1e-53) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.165d0)) then
tmp = sqrt((0.5d0 - (cos((th * 2.0d0)) / 2.0d0)))
else if (sin(ky) <= 1d-53) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.165) {
tmp = Math.sqrt((0.5 - (Math.cos((th * 2.0)) / 2.0)));
} else if (Math.sin(ky) <= 1e-53) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.165: tmp = math.sqrt((0.5 - (math.cos((th * 2.0)) / 2.0))) elif math.sin(ky) <= 1e-53: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.165) tmp = sqrt(Float64(0.5 - Float64(cos(Float64(th * 2.0)) / 2.0))); elseif (sin(ky) <= 1e-53) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.165) tmp = sqrt((0.5 - (cos((th * 2.0)) / 2.0))); elseif (sin(ky) <= 1e-53) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.165], N[Sqrt[N[(0.5 - N[(N[Cos[N[(th * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-53], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.165:\\
\;\;\;\;\sqrt{0.5 - \frac{\cos \left(th \cdot 2\right)}{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-53}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.165000000000000008Initial 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.6%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt0.9%
sqrt-unprod31.4%
pow231.4%
associate-*r/31.4%
*-commutative31.4%
associate-/l*31.5%
Applied egg-rr31.5%
*-inverses31.5%
*-commutative31.5%
Simplified31.5%
unpow231.5%
*-un-lft-identity31.5%
*-un-lft-identity31.5%
sin-mult23.7%
Applied egg-rr23.7%
div-sub23.7%
+-inverses23.7%
cos-023.7%
metadata-eval23.7%
count-223.7%
Simplified23.7%
if -0.165000000000000008 < (sin.f64 ky) < 1.00000000000000003e-53Initial program 87.8%
unpow287.8%
sqr-neg87.8%
sin-neg87.8%
sin-neg87.8%
unpow287.8%
associate-*l/87.3%
associate-/l*87.9%
unpow287.9%
Simplified99.6%
Taylor expanded in ky around 0 41.9%
if 1.00000000000000003e-53 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 60.0%
Final simplification42.9%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.7%
associate-/l*93.9%
unpow293.9%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (sqrt (- 0.5 (/ (cos (* th 2.0)) 2.0))) (if (<= (sin ky) 1e-53) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sqrt((0.5 - (cos((th * 2.0)) / 2.0)));
} else if (sin(ky) <= 1e-53) {
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.01d0)) then
tmp = sqrt((0.5d0 - (cos((th * 2.0d0)) / 2.0d0)))
else if (sin(ky) <= 1d-53) 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.01) {
tmp = Math.sqrt((0.5 - (Math.cos((th * 2.0)) / 2.0)));
} else if (Math.sin(ky) <= 1e-53) {
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.01: tmp = math.sqrt((0.5 - (math.cos((th * 2.0)) / 2.0))) elif math.sin(ky) <= 1e-53: 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.01) tmp = sqrt(Float64(0.5 - Float64(cos(Float64(th * 2.0)) / 2.0))); elseif (sin(ky) <= 1e-53) 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.01) tmp = sqrt((0.5 - (cos((th * 2.0)) / 2.0))); elseif (sin(ky) <= 1e-53) 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.01], N[Sqrt[N[(0.5 - N[(N[Cos[N[(th * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-53], 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.01:\\
\;\;\;\;\sqrt{0.5 - \frac{\cos \left(th \cdot 2\right)}{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-53}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt0.9%
sqrt-unprod32.2%
pow232.2%
associate-*r/32.2%
*-commutative32.2%
associate-/l*32.3%
Applied egg-rr32.3%
*-inverses32.3%
*-commutative32.3%
Simplified32.3%
unpow232.3%
*-un-lft-identity32.3%
*-un-lft-identity32.3%
sin-mult23.6%
Applied egg-rr23.6%
div-sub23.6%
+-inverses23.6%
cos-023.6%
metadata-eval23.6%
count-223.6%
Simplified23.6%
if -0.0100000000000000002 < (sin.f64 ky) < 1.00000000000000003e-53Initial program 87.2%
unpow287.2%
sqr-neg87.2%
sin-neg87.2%
sin-neg87.2%
unpow287.2%
associate-*l/86.8%
associate-/l*87.4%
unpow287.4%
Simplified99.6%
Taylor expanded in ky around 0 42.8%
associate-/l*43.6%
Simplified43.6%
if 1.00000000000000003e-53 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 60.0%
Final simplification43.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.6e-54) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-54) {
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 (ky <= 8.6d-54) 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 (ky <= 8.6e-54) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.6e-54: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.6e-54) 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 (ky <= 8.6e-54) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.6e-54], 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}\;ky \leq 8.6 \cdot 10^{-54}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.5999999999999999e-54Initial program 91.4%
unpow291.4%
sqr-neg91.4%
sin-neg91.4%
sin-neg91.4%
unpow291.4%
associate-*l/91.1%
associate-/l*91.4%
unpow291.4%
Simplified99.6%
Taylor expanded in ky around 0 29.5%
associate-/l*30.0%
Simplified30.0%
if 8.5999999999999999e-54 < 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.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 36.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.18) (sin th) (cbrt (pow th 3.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.18) {
tmp = sin(th);
} else {
tmp = cbrt(pow(th, 3.0));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.18) {
tmp = Math.sin(th);
} else {
tmp = Math.cbrt(Math.pow(th, 3.0));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.18) tmp = sin(th); else tmp = cbrt((th ^ 3.0)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.18], N[Sin[th], $MachinePrecision], N[Power[N[Power[th, 3.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.18:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{th}^{3}}\\
\end{array}
\end{array}
if kx < 0.17999999999999999Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/92.1%
associate-/l*92.4%
unpow292.4%
Simplified99.6%
Taylor expanded in kx around 0 29.8%
if 0.17999999999999999 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in kx around 0 8.9%
associate-*r/17.2%
clear-num17.2%
*-commutative17.2%
Applied egg-rr17.2%
Taylor expanded in th around 0 6.7%
remove-double-div6.7%
add-cbrt-cube14.3%
pow314.3%
Applied egg-rr14.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.16) (sin th) (log (exp th))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.16) {
tmp = sin(th);
} else {
tmp = log(exp(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 <= 0.16d0) then
tmp = sin(th)
else
tmp = log(exp(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.16) {
tmp = Math.sin(th);
} else {
tmp = Math.log(Math.exp(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.16: tmp = math.sin(th) else: tmp = math.log(math.exp(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.16) tmp = sin(th); else tmp = log(exp(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.16) tmp = sin(th); else tmp = log(exp(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.16], N[Sin[th], $MachinePrecision], N[Log[N[Exp[th], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.16:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{th}\right)\\
\end{array}
\end{array}
if kx < 0.160000000000000003Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/92.1%
associate-/l*92.4%
unpow292.4%
Simplified99.6%
Taylor expanded in kx around 0 29.8%
if 0.160000000000000003 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in kx around 0 8.9%
associate-*r/17.2%
clear-num17.2%
*-commutative17.2%
Applied egg-rr17.2%
Taylor expanded in th around 0 6.7%
remove-double-div6.7%
add-log-exp13.2%
Applied egg-rr13.2%
(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 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.7%
associate-/l*93.9%
unpow293.9%
Simplified99.6%
Taylor expanded in kx around 0 25.3%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
associate-*l/93.7%
associate-/l*93.9%
unpow293.9%
Simplified99.6%
Taylor expanded in kx around 0 25.2%
Taylor expanded in th around 0 14.4%
herbie shell --seed 2024106
(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)))