
(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.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.3%
associate-/l*93.2%
unpow293.2%
Simplified99.6%
associate-*r/95.3%
hypot-undefine91.3%
unpow291.3%
unpow291.3%
+-commutative91.3%
associate-*l/93.2%
*-commutative93.2%
clear-num93.1%
un-div-inv93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.025)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(if (<= (sin ky) 5e-118)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-16)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.025) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else if (sin(ky) <= 5e-118) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-16) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.025) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} else if (Math.sin(ky) <= 5e-118) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-16) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.025: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) elif math.sin(ky) <= 5e-118: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-16: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.025) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); elseif (sin(ky) <= 5e-118) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-16) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.025) tmp = (th * sin(ky)) / hypot(sin(ky), kx); elseif (sin(ky) <= 5e-118) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-16) tmp = (th * ky) / hypot(sin(ky), sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.025], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-118], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-16], N[(N[(th * ky), $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.025:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-118}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-16}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.025000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 58.4%
Taylor expanded in kx around 0 32.3%
if -0.025000000000000001 < (sin.f64 ky) < 5.00000000000000015e-118Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/80.1%
associate-/l*83.7%
unpow283.7%
Simplified99.7%
Taylor expanded in ky around 0 46.3%
if 5.00000000000000015e-118 < (sin.f64 ky) < 9.9999999999999998e-17Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/95.1%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
associate-*r/95.1%
Applied egg-rr95.1%
Taylor expanded in th around 0 80.5%
Taylor expanded in ky around 0 80.5%
if 9.9999999999999998e-17 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 55.5%
Final simplification47.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.025)
(/ 1.0 (/ (sin ky) (fabs (* th (sin ky)))))
(if (<= (sin ky) 5e-118)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-16)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.025) {
tmp = 1.0 / (sin(ky) / fabs((th * sin(ky))));
} else if (sin(ky) <= 5e-118) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-16) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.025) {
tmp = 1.0 / (Math.sin(ky) / Math.abs((th * Math.sin(ky))));
} else if (Math.sin(ky) <= 5e-118) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-16) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.025: tmp = 1.0 / (math.sin(ky) / math.fabs((th * math.sin(ky)))) elif math.sin(ky) <= 5e-118: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-16: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.025) tmp = Float64(1.0 / Float64(sin(ky) / abs(Float64(th * sin(ky))))); elseif (sin(ky) <= 5e-118) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-16) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.025) tmp = 1.0 / (sin(ky) / abs((th * sin(ky)))); elseif (sin(ky) <= 5e-118) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-16) tmp = (th * ky) / hypot(sin(ky), sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.025], N[(1.0 / N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-118], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-16], N[(N[(th * ky), $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.025:\\
\;\;\;\;\frac{1}{\frac{\sin ky}{\left|th \cdot \sin ky\right|}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-118}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-16}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.025000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-*r/2.7%
clear-num2.7%
*-commutative2.7%
Applied egg-rr2.7%
Taylor expanded in th around 0 3.2%
add-sqr-sqrt1.6%
sqrt-unprod10.3%
pow210.3%
*-commutative10.3%
Applied egg-rr10.3%
unpow210.3%
rem-sqrt-square19.0%
*-commutative19.0%
Simplified19.0%
if -0.025000000000000001 < (sin.f64 ky) < 5.00000000000000015e-118Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/80.1%
associate-/l*83.7%
unpow283.7%
Simplified99.7%
Taylor expanded in ky around 0 46.3%
if 5.00000000000000015e-118 < (sin.f64 ky) < 9.9999999999999998e-17Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/95.1%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
associate-*r/95.1%
Applied egg-rr95.1%
Taylor expanded in th around 0 80.5%
Taylor expanded in ky around 0 80.5%
if 9.9999999999999998e-17 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 55.5%
Final simplification44.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.015)
(* (* (sin th) ky) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 5e-121)
(sin th)
(if (<= (sin kx) 5e-17)
(/ (* 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.015) {
tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 5e-121) {
tmp = sin(th);
} else if (sin(kx) <= 5e-17) {
tmp = (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.015) {
tmp = (Math.sin(th) * ky) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 5e-121) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 5e-17) {
tmp = (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.015: tmp = (math.sin(th) * ky) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 5e-121: tmp = math.sin(th) elif math.sin(kx) <= 5e-17: tmp = (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.015) tmp = Float64(Float64(sin(th) * ky) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 5e-121) tmp = sin(th); elseif (sin(kx) <= 5e-17) tmp = Float64(Float64(th * 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.015) tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 5e-121) tmp = sin(th); elseif (sin(kx) <= 5e-17) tmp = (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.015], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-121], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-17], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $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.015:\\
\;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-121}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{th \cdot \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.014999999999999999Initial program 99.3%
unpow299.3%
sin-mult99.0%
Applied egg-rr99.0%
div-sub99.0%
+-inverses99.0%
cos-099.0%
metadata-eval99.0%
count-299.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in ky around 0 53.5%
if -0.014999999999999999 < (sin.f64 kx) < 4.99999999999999989e-121Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/78.2%
associate-/l*82.1%
unpow282.1%
Simplified99.7%
Taylor expanded in kx around 0 31.5%
if 4.99999999999999989e-121 < (sin.f64 kx) < 4.9999999999999999e-17Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/94.8%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/94.8%
Applied egg-rr94.8%
Taylor expanded in th around 0 73.6%
Taylor expanded in kx around 0 73.6%
if 4.9999999999999999e-17 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.5%
Taylor expanded in ky around 0 55.2%
Final simplification47.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.015)
(* (* (sin th) ky) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 5e-59)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin kx) 5e-17)
(/ (* 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.015) {
tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 5e-59) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(kx) <= 5e-17) {
tmp = (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.015) {
tmp = (Math.sin(th) * ky) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 5e-59) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(kx) <= 5e-17) {
tmp = (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.015: tmp = (math.sin(th) * ky) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 5e-59: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(kx) <= 5e-17: tmp = (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.015) tmp = Float64(Float64(sin(th) * ky) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 5e-59) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(kx) <= 5e-17) tmp = Float64(Float64(th * 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.015) tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 5e-59) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(kx) <= 5e-17) tmp = (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.015], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-59], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-17], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $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.015:\\
\;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-59}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{th \cdot \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.014999999999999999Initial program 99.3%
unpow299.3%
sin-mult99.0%
Applied egg-rr99.0%
div-sub99.0%
+-inverses99.0%
cos-099.0%
metadata-eval99.0%
count-299.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in ky around 0 53.5%
if -0.014999999999999999 < (sin.f64 kx) < 5.0000000000000001e-59Initial program 83.8%
unpow283.8%
sqr-neg83.8%
sin-neg83.8%
sin-neg83.8%
unpow283.8%
associate-*l/79.2%
associate-/l*83.7%
unpow283.7%
Simplified99.7%
Taylor expanded in kx around 0 32.8%
add-sqr-sqrt16.0%
sqrt-unprod30.0%
pow230.0%
Applied egg-rr30.0%
unpow230.0%
rem-sqrt-square41.6%
Simplified41.6%
if 5.0000000000000001e-59 < (sin.f64 kx) < 4.9999999999999999e-17Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.7%
associate-/l*99.3%
unpow299.3%
Simplified99.3%
associate-*r/99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 88.9%
Taylor expanded in kx around 0 88.9%
if 4.9999999999999999e-17 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.5%
Taylor expanded in ky around 0 55.2%
Final simplification50.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.025)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-57)
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(if (<= (sin ky) 1e-16)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.025) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-57) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else if (sin(ky) <= 1e-16) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.025) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-57) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else if (Math.sin(ky) <= 1e-16) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.025: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-57: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) elif math.sin(ky) <= 1e-16: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.025) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-57) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); elseif (sin(ky) <= 1e-16) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.025) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-57) tmp = sin(th) * (sin(ky) / abs(sin(kx))); elseif (sin(ky) <= 1e-16) tmp = (th * ky) / hypot(sin(ky), sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.025], 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-57], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-16], N[(N[(th * ky), $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.025:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-57}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin ky \leq 10^{-16}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.025000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.2%
sqrt-unprod23.5%
pow223.5%
Applied egg-rr23.5%
unpow223.5%
rem-sqrt-square32.2%
Simplified32.2%
if -0.025000000000000001 < (sin.f64 ky) < 9.99999999999999955e-58Initial program 85.6%
unpow285.6%
sin-mult72.2%
Applied egg-rr72.2%
div-sub72.2%
+-inverses72.2%
cos-072.2%
metadata-eval72.2%
count-272.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in ky around 0 54.3%
add-sqr-sqrt54.3%
rem-sqrt-square54.3%
sqr-sin-a68.2%
sqrt-unprod40.9%
add-sqr-sqrt75.6%
Applied egg-rr75.6%
if 9.99999999999999955e-58 < (sin.f64 ky) < 9.9999999999999998e-17Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.0%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/99.0%
Applied egg-rr99.0%
Taylor expanded in th around 0 82.7%
Taylor expanded in ky around 0 82.7%
if 9.9999999999999998e-17 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 55.5%
Final simplification59.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (/ (* th ky) (hypot (sin ky) (sin kx))) (if (<= (sin kx) 2e-51) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(kx) <= 2e-51) {
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) <= -0.01) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(kx) <= 2e-51) {
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) <= -0.01: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(kx) <= 2e-51: 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) <= -0.01) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(kx) <= 2e-51) 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) <= -0.01) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(kx) <= 2e-51) 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], -0.01], 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], 2e-51], 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 -0.01:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 47.4%
Taylor expanded in ky around 0 28.7%
if -0.0100000000000000002 < (sin.f64 kx) < 2e-51Initial program 83.8%
unpow283.8%
sqr-neg83.8%
sin-neg83.8%
sin-neg83.8%
unpow283.8%
associate-*l/79.2%
associate-/l*83.7%
unpow283.7%
Simplified99.7%
Taylor expanded in kx around 0 32.8%
if 2e-51 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.5%
Taylor expanded in ky around 0 55.6%
Final simplification39.4%
(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.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.3%
associate-/l*93.2%
unpow293.2%
Simplified99.6%
Final simplification99.6%
(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.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 3.6e-6)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 1.2e+82)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* th (sin ky))))
(* (sin th) (/ (sin ky) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 1.2e+82) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 1.2e+82) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (th * Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.6e-6: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 1.2e+82: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (th * math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.6e-6) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 1.2e+82) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(th * sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.6e-6) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 1.2e+82) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.6e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 1.2e+82], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 1.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th \cdot \sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 3.59999999999999984e-6Initial program 91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 66.6%
if 3.59999999999999984e-6 < kx < 1.19999999999999999e82Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 61.8%
clear-num61.9%
inv-pow61.9%
*-commutative61.9%
Applied egg-rr61.9%
unpow-161.9%
*-commutative61.9%
Simplified61.9%
if 1.19999999999999999e82 < kx Initial program 99.4%
unpow299.4%
sin-mult98.9%
Applied egg-rr98.9%
div-sub98.9%
+-inverses98.9%
cos-098.9%
metadata-eval98.9%
count-298.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in ky around 0 68.6%
add-sqr-sqrt68.6%
rem-sqrt-square68.6%
sqr-sin-a69.0%
sqrt-unprod31.2%
add-sqr-sqrt69.0%
Applied egg-rr69.0%
Final simplification66.8%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 3.6e-6)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 1.6e+82)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(* (sin th) (/ (sin ky) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 1.6e+82) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 1.6e+82) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.6e-6: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 1.6e+82: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.6e-6) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 1.6e+82) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.6e-6) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 1.6e+82) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.6e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 1.6e+82], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 1.6 \cdot 10^{+82}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 3.59999999999999984e-6Initial program 91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 66.6%
if 3.59999999999999984e-6 < kx < 1.59999999999999987e82Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 61.8%
associate-/l*61.9%
*-commutative61.9%
Applied egg-rr61.9%
if 1.59999999999999987e82 < kx Initial program 99.4%
unpow299.4%
sin-mult98.9%
Applied egg-rr98.9%
div-sub98.9%
+-inverses98.9%
cos-098.9%
metadata-eval98.9%
count-298.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in ky around 0 68.6%
add-sqr-sqrt68.6%
rem-sqrt-square68.6%
sqr-sin-a69.0%
sqrt-unprod31.2%
add-sqr-sqrt69.0%
Applied egg-rr69.0%
Final simplification66.8%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 3.6e-6)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 3.6e+81)
(/ (* th (sin ky)) (hypot (sin ky) (sin kx)))
(* (sin th) (/ (sin ky) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 3.6e+81) {
tmp = (th * sin(ky)) / hypot(sin(ky), sin(kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.6e-6) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 3.6e+81) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.6e-6: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 3.6e+81: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.6e-6) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 3.6e+81) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), sin(kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.6e-6) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 3.6e+81) tmp = (th * sin(ky)) / hypot(sin(ky), sin(kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.6e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 3.6e+81], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 3.6 \cdot 10^{+81}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 3.59999999999999984e-6Initial program 91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 66.6%
if 3.59999999999999984e-6 < kx < 3.60000000000000005e81Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 61.8%
if 3.60000000000000005e81 < kx Initial program 99.4%
unpow299.4%
sin-mult98.9%
Applied egg-rr98.9%
div-sub98.9%
+-inverses98.9%
cos-098.9%
metadata-eval98.9%
count-298.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in ky around 0 68.6%
add-sqr-sqrt68.6%
rem-sqrt-square68.6%
sqr-sin-a69.0%
sqrt-unprod31.2%
add-sqr-sqrt69.0%
Applied egg-rr69.0%
Final simplification66.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.102) (* (sin ky) (/ (sin th) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.102) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.102) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.102: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.102) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.102) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.102], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.102:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.101999999999999993Initial program 91.1%
unpow291.1%
sqr-neg91.1%
sin-neg91.1%
sin-neg91.1%
unpow291.1%
associate-*l/88.6%
associate-/l*91.0%
unpow291.0%
Simplified99.6%
Taylor expanded in kx around 0 66.4%
if 0.101999999999999993 < kx Initial program 99.4%
unpow299.4%
sin-mult99.0%
Applied egg-rr99.0%
div-sub99.0%
+-inverses99.0%
cos-099.0%
metadata-eval99.0%
count-299.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in ky around 0 66.2%
add-sqr-sqrt66.2%
rem-sqrt-square66.2%
sqr-sin-a66.6%
sqrt-unprod33.0%
add-sqr-sqrt66.6%
Applied egg-rr66.6%
Final simplification66.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.105) (* (sin th) (/ (sin ky) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.105) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.105) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.105: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.105) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.105) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.105], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.105:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.104999999999999996Initial program 91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in kx around 0 66.5%
if 0.104999999999999996 < kx Initial program 99.4%
unpow299.4%
sin-mult99.0%
Applied egg-rr99.0%
div-sub99.0%
+-inverses99.0%
cos-099.0%
metadata-eval99.0%
count-299.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in ky around 0 66.2%
add-sqr-sqrt66.2%
rem-sqrt-square66.2%
sqr-sin-a66.6%
sqrt-unprod33.0%
add-sqr-sqrt66.6%
Applied egg-rr66.6%
Final simplification66.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.15e-47) (sin th) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.15e-47) {
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.15d-47) 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.15e-47) {
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.15e-47: 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.15e-47) 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.15e-47) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.15e-47], 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.15 \cdot 10^{-47}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 2.1499999999999999e-47Initial program 90.4%
unpow290.4%
sqr-neg90.4%
sin-neg90.4%
sin-neg90.4%
unpow290.4%
associate-*l/87.7%
associate-/l*90.3%
unpow290.3%
Simplified99.7%
Taylor expanded in kx around 0 23.2%
if 2.1499999999999999e-47 < 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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 44.3%
Final simplification29.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 9.6e-40) (sin th) (* ky (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 9.6e-40) {
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 (kx <= 9.6d-40) 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 (kx <= 9.6e-40) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 9.6e-40: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 9.6e-40) 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 (kx <= 9.6e-40) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 9.6e-40], 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}\;kx \leq 9.6 \cdot 10^{-40}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 9.59999999999999965e-40Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/87.8%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in kx around 0 23.6%
if 9.59999999999999965e-40 < 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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 40.2%
associate-/l*40.2%
Simplified40.2%
Final simplification28.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.45e-39) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.45e-39) {
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.45d-39) 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.45e-39) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.45e-39: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.45e-39) 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.45e-39) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.45e-39], 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.45 \cdot 10^{-39}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.44999999999999994e-39Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/87.8%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in kx around 0 23.6%
if 1.44999999999999994e-39 < 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.6%
unpow299.6%
Simplified99.6%
associate-*r/99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 57.0%
Taylor expanded in ky around 0 28.6%
associate-/l*28.6%
Simplified28.6%
Final simplification25.1%
(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.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.3%
associate-/l*93.2%
unpow293.2%
Simplified99.6%
Taylor expanded in kx around 0 20.0%
Final simplification20.0%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/91.3%
associate-/l*93.2%
unpow293.2%
Simplified99.6%
Taylor expanded in kx around 0 20.0%
Taylor expanded in th around 0 13.2%
Final simplification13.2%
herbie shell --seed 2024077
(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)))