
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 90.0%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.7
Simplified99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot kx (sin ky)))))
(t_2 (/ (sin ky) (hypot (sin ky) (sin kx))))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -0.99975)
t_1
(if (<= t_4 -0.5)
(* t_2 (fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_4 1e-9)
(* (sin th) (* (sin ky) (sqrt (/ 1.0 t_3))))
(if (<= t_4 0.9995)
(*
t_2
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
double t_2 = sin(ky) / hypot(sin(ky), sin(kx));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -0.99975) {
tmp = t_1;
} else if (t_4 <= -0.5) {
tmp = t_2 * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_4 <= 1e-9) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / t_3)));
} else if (t_4 <= 0.9995) {
tmp = t_2 * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))) t_2 = Float64(sin(ky) / hypot(sin(ky), sin(kx))) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -0.99975) tmp = t_1; elseif (t_4 <= -0.5) tmp = Float64(t_2 * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_4 <= 1e-9) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / t_3)))); elseif (t_4 <= 0.9995) tmp = Float64(t_2 * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.99975], t$95$1, If[LessEqual[t$95$4, -0.5], N[(t$95$2 * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.9995], N[(t$95$2 * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
t_2 := \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -0.99975:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq -0.5:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_4 \leq 10^{-9}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{t\_3}}\right)\\
\mathbf{elif}\;t\_4 \leq 0.9995:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.999750000000000028 or 0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 75.2%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6474.2
Simplified74.2%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6499.0
Simplified99.0%
if -0.999750000000000028 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.5Initial program 99.7%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.5
Simplified99.5%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.3
Simplified67.3%
if -0.5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000006e-9Initial program 99.6%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.6
Simplified99.6%
Taylor expanded in ky around inf
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6495.7
Simplified95.7%
if 1.00000000000000006e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99950000000000006Initial program 99.2%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.2
Simplified99.2%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.0
Simplified48.0%
Final simplification88.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot kx (sin ky)))))
(t_2
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -0.99975)
t_1
(if (<= t_4 -0.5)
t_2
(if (<= t_4 1e-9)
(* (sin th) (* (sin ky) (sqrt (/ 1.0 t_3))))
(if (<= t_4 0.9995) t_2 t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
double t_2 = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -0.99975) {
tmp = t_1;
} else if (t_4 <= -0.5) {
tmp = t_2;
} else if (t_4 <= 1e-9) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / t_3)));
} else if (t_4 <= 0.9995) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))) t_2 = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -0.99975) tmp = t_1; elseif (t_4 <= -0.5) tmp = t_2; elseif (t_4 <= 1e-9) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / t_3)))); elseif (t_4 <= 0.9995) tmp = t_2; else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.99975], t$95$1, If[LessEqual[t$95$4, -0.5], t$95$2, If[LessEqual[t$95$4, 1e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.9995], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
t_2 := \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -0.99975:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq -0.5:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 10^{-9}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{t\_3}}\right)\\
\mathbf{elif}\;t\_4 \leq 0.9995:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.999750000000000028 or 0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 75.2%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6474.2
Simplified74.2%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6499.0
Simplified99.0%
if -0.999750000000000028 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.5 or 1.00000000000000006e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99950000000000006Initial program 99.5%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.3
Simplified99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.7
Simplified55.7%
if -0.5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000006e-9Initial program 99.6%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.6
Simplified99.6%
Taylor expanded in ky around inf
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6495.7
Simplified95.7%
Final simplification88.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot kx (sin ky)))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0))))))
(if (<= t_3 -0.2)
t_1
(if (<= t_3 0.001)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_2 (* ky (fma ky (* (* ky ky) -0.3333333333333333) ky))))))
(if (<= t_3 0.9995) (* (* (sin ky) (sin th)) (/ 1.0 (sin ky))) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double tmp;
if (t_3 <= -0.2) {
tmp = t_1;
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_2 + (ky * fma(ky, ((ky * ky) * -0.3333333333333333), ky)))));
} else if (t_3 <= 0.9995) {
tmp = (sin(ky) * sin(th)) * (1.0 / sin(ky));
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.2) tmp = t_1; elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_2 + Float64(ky * fma(ky, Float64(Float64(ky * ky) * -0.3333333333333333), ky)))))); elseif (t_3 <= 0.9995) tmp = Float64(Float64(sin(ky) * sin(th)) * Float64(1.0 / sin(ky))); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.2], t$95$1, If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9995], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_3 \leq -0.2:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_2 + ky \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.3333333333333333, ky\right)}}\\
\mathbf{elif}\;t\_3 \leq 0.9995:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \frac{1}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001 or 0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 80.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6459.4
Simplified59.4%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6478.7
Simplified78.7%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.6
Simplified99.6%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.6
Simplified99.6%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99950000000000006Initial program 99.2%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.2
Simplified99.2%
Taylor expanded in ky around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6499.1
Simplified99.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-sin.f6422.2
Simplified22.2%
Final simplification80.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fma ky (* -0.16666666666666666 (* ky ky)) ky))
(t_2 (pow (sin kx) 2.0))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_2 t_3)))))
(if (<= t_4 -0.2)
(*
th
(*
(sqrt (/ 1.0 t_3))
(* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))))
(if (<= t_4 0.001)
(*
(sin th)
(/
t_1
(sqrt (+ t_2 (* ky (fma ky (* (* ky ky) -0.3333333333333333) ky))))))
(if (<= t_4 2.0) (sin th) (* (sin th) (/ t_1 (hypot kx (sin ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = fma(ky, (-0.16666666666666666 * (ky * ky)), ky);
double t_2 = pow(sin(kx), 2.0);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((t_2 + t_3));
double tmp;
if (t_4 <= -0.2) {
tmp = th * (sqrt((1.0 / t_3)) * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0)));
} else if (t_4 <= 0.001) {
tmp = sin(th) * (t_1 / sqrt((t_2 + (ky * fma(ky, ((ky * ky) * -0.3333333333333333), ky)))));
} else if (t_4 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(th) * (t_1 / hypot(kx, sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) t_2 = sin(kx) ^ 2.0 t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_2 + t_3))) tmp = 0.0 if (t_4 <= -0.2) tmp = Float64(th * Float64(sqrt(Float64(1.0 / t_3)) * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0)))); elseif (t_4 <= 0.001) tmp = Float64(sin(th) * Float64(t_1 / sqrt(Float64(t_2 + Float64(ky * fma(ky, Float64(Float64(ky * ky) * -0.3333333333333333), ky)))))); elseif (t_4 <= 2.0) tmp = sin(th); else tmp = Float64(sin(th) * Float64(t_1 / hypot(kx, sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.2], N[(th * N[(N[Sqrt[N[(1.0 / t$95$3), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sqrt[N[(t$95$2 + N[(ky * N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_2 + t\_3}}\\
\mathbf{if}\;t\_4 \leq -0.2:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{t\_3}} \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\right)\\
\mathbf{elif}\;t\_4 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{t\_1}{\sqrt{t\_2 + ky \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.3333333333333333, ky\right)}}\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{t\_1}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 87.0%
Taylor expanded in th around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
Simplified48.5%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6431.2
Simplified31.2%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.6
Simplified99.6%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.6
Simplified99.6%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.0%
Taylor expanded in kx around 0
lower-sin.f6465.4
Simplified65.4%
if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 2.4%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64100.0
Simplified100.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
Final simplification70.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.98)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(/ (sin ky) (hypot (sin ky) kx)))
(if (<= t_1 0.15)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_1 2.0)
(sin th)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(hypot kx (sin ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.98) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) / hypot(sin(ky), kx));
} else if (t_1 <= 0.15) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / hypot(kx, sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.98) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (t_1 <= 0.15) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / hypot(kx, sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.98], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.98:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;t\_1 \leq 0.15:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 79.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6476.8
Simplified76.8%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.0
Simplified42.0%
Taylor expanded in ky around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6452.4
Simplified52.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.149999999999999994Initial program 99.6%
Taylor expanded in ky around 0
lower-sin.f6448.0
Simplified48.0%
if 0.149999999999999994 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.0%
Taylor expanded in kx around 0
lower-sin.f6466.1
Simplified66.1%
if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 2.4%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64100.0
Simplified100.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
Final simplification56.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.98)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(/ (sin ky) (hypot (sin ky) kx)))
(if (<= t_1 0.15) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.98) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) / hypot(sin(ky), kx));
} else if (t_1 <= 0.15) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.98) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (t_1 <= 0.15) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.98], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.98:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;t\_1 \leq 0.15:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 79.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6476.8
Simplified76.8%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.0
Simplified42.0%
Taylor expanded in ky around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6452.4
Simplified52.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.149999999999999994Initial program 99.6%
Taylor expanded in ky around 0
lower-sin.f6448.0
Simplified48.0%
if 0.149999999999999994 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Simplified62.6%
Final simplification53.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.15) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.15) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.15d0) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.15) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.15: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.15) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.15) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.15:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.149999999999999994Initial program 94.1%
Taylor expanded in ky around 0
lower-sin.f6436.9
Simplified36.9%
if 0.149999999999999994 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Simplified62.6%
Final simplification45.1%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.001) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.001d0) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.001) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.001: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.001) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 94.1%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.7
Simplified99.7%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6435.2
Simplified35.2%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.5%
Taylor expanded in kx around 0
lower-sin.f6462.1
Simplified62.1%
Final simplification43.9%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-9) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 5e-9) {
tmp = sin(ky) * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 5d-9) then
tmp = sin(ky) * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 5e-9) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 5e-9: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 5e-9], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-9Initial program 94.1%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.8
Simplified50.8%
Taylor expanded in ky around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6425.0
Simplified25.0%
Taylor expanded in kx around inf
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-sin.f6425.2
Simplified25.2%
if 5.0000000000000001e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.7%
Taylor expanded in kx around 0
lower-sin.f6461.5
Simplified61.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-9)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(fma (* ky ky) (/ 0.5 kx) kx)))
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 5e-9) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / fma((ky * ky), (0.5 / kx), kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / fma(Float64(ky * ky), Float64(0.5 / kx), kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 5e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[(N[(ky * ky), $MachinePrecision] * N[(0.5 / kx), $MachinePrecision] + kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{fma}\left(ky \cdot ky, \frac{0.5}{kx}, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-9Initial program 94.1%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.8
Simplified50.8%
Taylor expanded in ky around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6425.0
Simplified25.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6424.3
Simplified24.3%
if 5.0000000000000001e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.7%
Taylor expanded in kx around 0
lower-sin.f6461.5
Simplified61.5%
Final simplification36.5%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-317)
(* -0.16666666666666666 (* th (* th th)))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-317) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-317) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * 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]), $MachinePrecision], 1e-317], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-317}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 1.00000023e-317Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6418.3
Simplified18.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6411.5
Simplified11.5%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.0
Simplified18.0%
if 1.00000023e-317 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 85.8%
Taylor expanded in kx around 0
lower-sin.f6429.4
Simplified29.4%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6420.6
Simplified20.6%
Final simplification19.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-9) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 5e-9) {
tmp = sin(th) * (ky / 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) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 5d-9) then
tmp = sin(th) * (ky / 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) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 5e-9) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 5e-9: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 5e-9], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-9Initial program 94.1%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.8
Simplified50.8%
Taylor expanded in ky around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6425.0
Simplified25.0%
Taylor expanded in ky around 0
lower-/.f6424.6
Simplified24.6%
if 5.0000000000000001e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.7%
Taylor expanded in kx around 0
lower-sin.f6461.5
Simplified61.5%
Final simplification36.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-9) (* ky (fma -0.16666666666666666 (/ (* th (* th th)) kx) (/ th kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 5e-9) {
tmp = ky * fma(-0.16666666666666666, ((th * (th * th)) / kx), (th / kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = Float64(ky * fma(-0.16666666666666666, Float64(Float64(th * Float64(th * th)) / kx), Float64(th / kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 5e-9], N[(ky * N[(-0.16666666666666666 * N[(N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision] + N[(th / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;ky \cdot \mathsf{fma}\left(-0.16666666666666666, \frac{th \cdot \left(th \cdot th\right)}{kx}, \frac{th}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-9Initial program 94.1%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.8
Simplified50.8%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.8
Simplified35.8%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6422.2
Simplified22.2%
if 5.0000000000000001e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.7%
Taylor expanded in kx around 0
lower-sin.f6461.5
Simplified61.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-9) (* ky (fma -0.16666666666666666 (/ (* th (* th th)) kx) (/ th kx))) (fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 5e-9) {
tmp = ky * fma(-0.16666666666666666, ((th * (th * th)) / kx), (th / kx));
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 5e-9) tmp = Float64(ky * fma(-0.16666666666666666, Float64(Float64(th * Float64(th * th)) / kx), Float64(th / kx))); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 5e-9], N[(ky * N[(-0.16666666666666666 * N[(N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision] + N[(th / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;ky \cdot \mathsf{fma}\left(-0.16666666666666666, \frac{th \cdot \left(th \cdot th\right)}{kx}, \frac{th}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-9Initial program 94.1%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.8
Simplified50.8%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.8
Simplified35.8%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6422.2
Simplified22.2%
if 5.0000000000000001e-9 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.7%
Taylor expanded in kx around 0
lower-sin.f6461.5
Simplified61.5%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.7
Simplified38.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1e-15) (/ (* ky (fma -0.16666666666666666 (* th (* th th)) th)) kx) (fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 1e-15) {
tmp = (ky * fma(-0.16666666666666666, (th * (th * th)), th)) / kx;
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1e-15) tmp = Float64(Float64(ky * fma(-0.16666666666666666, Float64(th * Float64(th * th)), th)) / kx); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 1e-15], N[(N[(ky * N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-15}:\\
\;\;\;\;\frac{ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot \left(th \cdot th\right), th\right)}{kx}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.0000000000000001e-15Initial program 94.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.5
Simplified50.5%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.4
Simplified35.4%
Taylor expanded in kx around inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6421.7
Simplified21.7%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6420.1
Simplified20.1%
if 1.0000000000000001e-15 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 81.9%
Taylor expanded in kx around 0
lower-sin.f6460.9
Simplified60.9%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.4
Simplified38.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 7.5e-33) (* -0.16666666666666666 (* th (* th th))) (fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 7.5e-33) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 7.5e-33) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 7.5e-33], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 7.5 \cdot 10^{-33}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 7.5000000000000001e-33Initial program 93.9%
Taylor expanded in kx around 0
lower-sin.f643.6
Simplified3.6%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f643.5
Simplified3.5%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6416.9
Simplified16.9%
if 7.5000000000000001e-33 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 82.6%
Taylor expanded in kx around 0
lower-sin.f6459.2
Simplified59.2%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0255) (* (sin th) (/ (sin ky) (hypot kx (sin ky)))) (* (sqrt (/ 1.0 (pow (sin kx) 2.0))) (* (sin ky) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0255) {
tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
} else {
tmp = sqrt((1.0 / pow(sin(kx), 2.0))) * (sin(ky) * sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0255) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(kx, Math.sin(ky)));
} else {
tmp = Math.sqrt((1.0 / Math.pow(Math.sin(kx), 2.0))) * (Math.sin(ky) * Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.0255: tmp = math.sin(th) * (math.sin(ky) / math.hypot(kx, math.sin(ky))) else: tmp = math.sqrt((1.0 / math.pow(math.sin(kx), 2.0))) * (math.sin(ky) * math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.0255) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))); else tmp = Float64(sqrt(Float64(1.0 / (sin(kx) ^ 2.0))) * Float64(sin(ky) * sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.0255) tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky))); else tmp = sqrt((1.0 / (sin(kx) ^ 2.0))) * (sin(ky) * sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.0255], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.0255:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{{\sin kx}^{2}}} \cdot \left(\sin ky \cdot \sin th\right)\\
\end{array}
\end{array}
if kx < 0.0254999999999999984Initial program 86.6%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6460.4
Simplified60.4%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6473.6
Simplified73.6%
if 0.0254999999999999984 < kx Initial program 99.4%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.5
Simplified99.5%
Taylor expanded in ky around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6499.3
Simplified99.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6459.8
Simplified59.8%
Final simplification70.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0255) (* (sin th) (/ (sin ky) (hypot kx (sin ky)))) (* (sin th) (* (sin ky) (sqrt (/ 1.0 (pow (sin kx) 2.0)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0255) {
tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
} else {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / pow(sin(kx), 2.0))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0255) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(kx, Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((1.0 / Math.pow(Math.sin(kx), 2.0))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.0255: tmp = math.sin(th) * (math.sin(ky) / math.hypot(kx, math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((1.0 / math.pow(math.sin(kx), 2.0)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.0255) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / (sin(kx) ^ 2.0))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.0255) tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky))); else tmp = sin(th) * (sin(ky) * sqrt((1.0 / (sin(kx) ^ 2.0)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.0255], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.0255:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{{\sin kx}^{2}}}\right)\\
\end{array}
\end{array}
if kx < 0.0254999999999999984Initial program 86.6%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6460.4
Simplified60.4%
Taylor expanded in ky around inf
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f6473.6
Simplified73.6%
if 0.0254999999999999984 < kx Initial program 99.4%
Taylor expanded in kx around inf
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-sin.f64N/A
lower-sin.f6499.5
Simplified99.5%
Taylor expanded in ky around inf
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6499.3
Simplified99.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6459.9
Simplified59.9%
Final simplification70.0%
(FPCore (kx ky th) :precision binary64 (* -0.16666666666666666 (* th (* th th))))
double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (-0.16666666666666666d0) * (th * (th * th))
end function
public static double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
def code(kx, ky, th): return -0.16666666666666666 * (th * (th * th))
function code(kx, ky, th) return Float64(-0.16666666666666666 * Float64(th * Float64(th * th))) end
function tmp = code(kx, ky, th) tmp = -0.16666666666666666 * (th * (th * th)); end
code[kx_, ky_, th_] := N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)
\end{array}
Initial program 90.0%
Taylor expanded in kx around 0
lower-sin.f6422.7
Simplified22.7%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6415.2
Simplified15.2%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6412.9
Simplified12.9%
herbie shell --seed 2024215
(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)))