
(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 92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.02)
(* ky (fabs t_1))
(if (<= (sin kx) 1e-94) (sin th) (* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs(t_1);
} else if (sin(kx) <= 1e-94) {
tmp = sin(th);
} else {
tmp = sin(ky) * t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(th) / sin(kx)
if (sin(kx) <= (-0.02d0)) then
tmp = ky * abs(t_1)
else if (sin(kx) <= 1d-94) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs(t_1);
} else if (Math.sin(kx) <= 1e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs(t_1) elif math.sin(kx) <= 1e-94: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(t_1)); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs(t_1); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 14.2%
associate-/l*14.2%
Simplified14.2%
add-sqr-sqrt10.3%
sqrt-unprod37.1%
pow237.1%
Applied egg-rr37.1%
unpow237.1%
rem-sqrt-square38.6%
Simplified38.6%
if -0.0200000000000000004 < (sin.f64 kx) < 9.9999999999999996e-95Initial program 85.3%
associate-*l/78.9%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.7%
Taylor expanded in kx around 0 38.8%
if 9.9999999999999996e-95 < (sin.f64 kx) Initial program 99.5%
associate-*l/98.4%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 59.9%
Final simplification46.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-94) (sin th) (/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-94) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / 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(kx) <= (-0.02d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-94) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-94: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 14.2%
associate-/l*14.2%
Simplified14.2%
add-sqr-sqrt10.3%
sqrt-unprod37.1%
pow237.1%
Applied egg-rr37.1%
unpow237.1%
rem-sqrt-square38.6%
Simplified38.6%
if -0.0200000000000000004 < (sin.f64 kx) < 9.9999999999999996e-95Initial program 85.3%
associate-*l/78.9%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.7%
Taylor expanded in kx around 0 38.8%
if 9.9999999999999996e-95 < (sin.f64 kx) Initial program 99.5%
associate-*l/98.4%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 59.9%
clear-num59.9%
un-div-inv59.9%
Applied egg-rr59.9%
Final simplification46.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-94) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-94) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
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(kx) <= (-0.02d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-94) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-94: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 14.2%
associate-/l*14.2%
Simplified14.2%
add-sqr-sqrt10.3%
sqrt-unprod37.1%
pow237.1%
Applied egg-rr37.1%
unpow237.1%
rem-sqrt-square38.6%
Simplified38.6%
if -0.0200000000000000004 < (sin.f64 kx) < 9.9999999999999996e-95Initial program 85.3%
associate-*l/78.9%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.7%
Taylor expanded in kx around 0 38.8%
if 9.9999999999999996e-95 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 59.9%
*-commutative59.9%
clear-num59.9%
un-div-inv60.0%
Applied egg-rr60.0%
Final simplification46.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* (sin th) (/ (sin ky) (sin kx)))) (if (<= (sin kx) 1e-94) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1e-94) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
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(kx) <= (-0.02d0)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(kx) <= 1d-94) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1e-94: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 13.7%
clear-num13.7%
associate-/r/13.7%
Applied egg-rr13.7%
add-sqr-sqrt11.8%
sqrt-unprod24.8%
pow224.8%
*-commutative24.8%
associate-*l/24.8%
*-un-lft-identity24.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square45.1%
Simplified45.1%
if -0.0200000000000000004 < (sin.f64 kx) < 9.9999999999999996e-95Initial program 85.3%
associate-*l/78.9%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.7%
Taylor expanded in kx around 0 38.8%
if 9.9999999999999996e-95 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 59.9%
*-commutative59.9%
clear-num59.9%
un-div-inv60.0%
Applied egg-rr60.0%
Final simplification47.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 92.9%
associate-*l/89.6%
associate-/l*92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
unpow292.9%
sin-neg92.9%
sin-neg92.9%
sqr-neg92.9%
unpow292.9%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.075)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(/ (* ky (sin th)) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.075) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else {
tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.075) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(ky), Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.075: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) else: tmp = (ky * math.sin(th)) / math.hypot(math.sin(ky), math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.075) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); else tmp = Float64(Float64(ky * sin(th)) / hypot(sin(ky), sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.075) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); else tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.075], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.075:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0749999999999999972Initial program 93.9%
associate-*l/89.5%
associate-/l*93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
unpow293.8%
sin-neg93.8%
sin-neg93.8%
sqr-neg93.8%
unpow293.8%
Simplified99.7%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 62.7%
+-commutative62.7%
+-commutative62.7%
unpow262.7%
unpow262.7%
hypot-undefine65.6%
associate-*r*65.6%
+-commutative65.6%
unpow265.6%
unpow265.6%
hypot-undefine65.7%
distribute-rgt-out65.7%
Simplified65.7%
if 0.0749999999999999972 < th Initial program 89.8%
associate-*l/89.7%
associate-/l*89.6%
unpow289.6%
sqr-neg89.6%
sin-neg89.6%
sin-neg89.6%
unpow289.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
sqr-neg89.6%
unpow289.6%
Simplified99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 57.4%
Final simplification63.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-94) (sin th) (/ (sin th) (/ (sin kx) ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-94) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / ky);
}
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(kx) <= (-0.02d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-94) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-94: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-94) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 14.2%
associate-/l*14.2%
Simplified14.2%
add-sqr-sqrt10.3%
sqrt-unprod37.1%
pow237.1%
Applied egg-rr37.1%
unpow237.1%
rem-sqrt-square38.6%
Simplified38.6%
if -0.0200000000000000004 < (sin.f64 kx) < 9.9999999999999996e-95Initial program 85.3%
associate-*l/78.9%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.7%
Taylor expanded in kx around 0 38.8%
if 9.9999999999999996e-95 < (sin.f64 kx) Initial program 99.5%
associate-*l/98.4%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.5%
associate-*r/98.4%
hypot-undefine98.4%
unpow298.4%
unpow298.4%
+-commutative98.4%
associate-*l/99.5%
*-commutative99.5%
clear-num99.5%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 53.2%
Final simplification43.8%
(FPCore (kx ky th) :precision binary64 (if (<= th 1.5) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.5) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.5) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.5: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.5) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.5) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.5], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.5:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if th < 1.5Initial program 93.9%
associate-*l/89.6%
associate-/l*93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
unpow293.9%
sin-neg93.9%
sin-neg93.9%
sqr-neg93.9%
unpow293.9%
Simplified99.7%
associate-*r/93.8%
Applied egg-rr93.8%
Taylor expanded in th around 0 58.5%
*-commutative58.5%
associate-/l*64.4%
Applied egg-rr64.4%
if 1.5 < th Initial program 89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 25.5%
add-sqr-sqrt17.8%
sqrt-unprod18.3%
pow218.3%
Applied egg-rr18.3%
unpow218.3%
rem-sqrt-square34.3%
Simplified34.3%
Final simplification57.5%
(FPCore (kx ky th) :precision binary64 (if (<= th 1.5) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.5) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.5) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.5: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.5) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.5) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.5], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.5:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if th < 1.5Initial program 93.9%
associate-*l/89.6%
associate-/l*93.9%
unpow293.9%
sqr-neg93.9%
sin-neg93.9%
sin-neg93.9%
unpow293.9%
unpow293.9%
sin-neg93.9%
sin-neg93.9%
sqr-neg93.9%
unpow293.9%
Simplified99.7%
associate-*r/93.8%
Applied egg-rr93.8%
Taylor expanded in th around 0 58.5%
associate-/l*64.4%
*-commutative64.4%
Applied egg-rr64.4%
if 1.5 < th Initial program 89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 25.5%
add-sqr-sqrt17.8%
sqrt-unprod18.3%
pow218.3%
Applied egg-rr18.3%
unpow218.3%
rem-sqrt-square34.3%
Simplified34.3%
Final simplification57.6%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin ky) (sin kx)))) (if (<= th 0.0005) (* (/ (sin ky) t_1) th) (/ (* ky (sin th)) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (th <= 0.0005) {
tmp = (sin(ky) / t_1) * th;
} else {
tmp = (ky * sin(th)) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (th <= 0.0005) {
tmp = (Math.sin(ky) / t_1) * th;
} else {
tmp = (ky * Math.sin(th)) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if th <= 0.0005: tmp = (math.sin(ky) / t_1) * th else: tmp = (ky * math.sin(th)) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (th <= 0.0005) tmp = Float64(Float64(sin(ky) / t_1) * th); else tmp = Float64(Float64(ky * sin(th)) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (th <= 0.0005) tmp = (sin(ky) / t_1) * th; else tmp = (ky * sin(th)) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, 0.0005], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq 0.0005:\\
\;\;\;\;\frac{\sin ky}{t\_1} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\end{array}
\end{array}
if th < 5.0000000000000001e-4Initial program 93.9%
associate-*l/89.5%
associate-/l*93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
unpow293.8%
sin-neg93.8%
sin-neg93.8%
sqr-neg93.8%
unpow293.8%
Simplified99.7%
associate-*r/93.8%
Applied egg-rr93.8%
Taylor expanded in th around 0 58.7%
associate-/l*64.6%
*-commutative64.6%
Applied egg-rr64.6%
if 5.0000000000000001e-4 < th Initial program 89.8%
associate-*l/89.7%
associate-/l*89.6%
unpow289.6%
sqr-neg89.6%
sin-neg89.6%
sin-neg89.6%
unpow289.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
sqr-neg89.6%
unpow289.6%
Simplified99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 57.4%
Final simplification63.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.55e-94) (sin th) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.55e-94) {
tmp = sin(th);
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 2.55d-94) then
tmp = sin(th)
else
tmp = sin(th) * abs((sin(ky) / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.55e-94) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.55e-94: tmp = math.sin(th) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.55e-94) tmp = sin(th); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.55e-94) tmp = sin(th); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.55e-94], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.55 \cdot 10^{-94}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 2.5500000000000001e-94Initial program 90.1%
associate-*l/85.9%
associate-/l*90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
sqr-neg90.0%
unpow290.0%
Simplified99.6%
Taylor expanded in kx around 0 27.8%
if 2.5500000000000001e-94 < kx Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 41.6%
add-sqr-sqrt27.0%
sqrt-unprod33.1%
pow233.1%
Applied egg-rr33.1%
unpow233.1%
rem-sqrt-square37.9%
Simplified37.9%
Final simplification30.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-116) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-116) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-116) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-116) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-116: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-116) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-116) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-116], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-116}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-116Initial program 89.9%
associate-*l/86.6%
associate-/l*89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
sqr-neg89.9%
unpow289.9%
Simplified99.6%
Taylor expanded in ky around 0 32.8%
associate-/l*34.4%
Simplified34.4%
if 2e-116 < (sin.f64 ky) Initial program 99.7%
associate-*l/96.2%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification42.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-116) (/ ky (/ (sin kx) (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-116) {
tmp = ky / (sin(kx) / sin(th));
} 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) <= 2d-116) then
tmp = ky / (sin(kx) / sin(th))
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) <= 2e-116) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-116: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-116) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-116) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-116], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-116}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-116Initial program 89.9%
associate-*l/86.6%
associate-/l*89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
sqr-neg89.9%
unpow289.9%
Simplified99.6%
Taylor expanded in ky around 0 32.8%
associate-/l*34.4%
Simplified34.4%
clear-num34.4%
un-div-inv34.4%
Applied egg-rr34.4%
if 2e-116 < (sin.f64 ky) Initial program 99.7%
associate-*l/96.2%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification42.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-116) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-116) {
tmp = sin(th) / (sin(kx) / ky);
} 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) <= 2d-116) then
tmp = sin(th) / (sin(kx) / ky)
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) <= 2e-116) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-116: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-116) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-116) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-116], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-116}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-116Initial program 89.9%
associate-*l/86.6%
associate-/l*89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
sqr-neg89.9%
unpow289.9%
Simplified99.6%
associate-*r/94.6%
hypot-undefine86.6%
unpow286.6%
unpow286.6%
+-commutative86.6%
associate-*l/89.9%
*-commutative89.9%
clear-num89.9%
un-div-inv90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 34.4%
if 2e-116 < (sin.f64 ky) Initial program 99.7%
associate-*l/96.2%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 59.7%
Final simplification42.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.9e-184) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.9e-184) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.9d-184) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.9e-184) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.9e-184: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.9e-184) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.9e-184) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.9e-184], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.9 \cdot 10^{-184}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.90000000000000008e-184Initial program 90.2%
associate-*l/88.2%
associate-/l*90.1%
unpow290.1%
sqr-neg90.1%
sin-neg90.1%
sin-neg90.1%
unpow290.1%
unpow290.1%
sin-neg90.1%
sin-neg90.1%
sqr-neg90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in ky around 0 34.7%
associate-/l*36.4%
Simplified36.4%
Taylor expanded in th around 0 19.1%
associate-/l*20.7%
Simplified20.7%
if 1.90000000000000008e-184 < ky Initial program 96.7%
associate-*l/91.5%
associate-/l*96.6%
unpow296.6%
sqr-neg96.6%
sin-neg96.6%
sin-neg96.6%
unpow296.6%
unpow296.6%
sin-neg96.6%
sin-neg96.6%
sqr-neg96.6%
unpow296.6%
Simplified99.6%
Taylor expanded in kx around 0 39.1%
Final simplification28.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.3e-114) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.3e-114) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4.3d-114) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.3e-114) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.3e-114: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.3e-114) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.3e-114) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.3e-114], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.3 \cdot 10^{-114}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.3e-114Initial program 89.4%
associate-*l/85.9%
associate-/l*89.3%
unpow289.3%
sqr-neg89.3%
sin-neg89.3%
sin-neg89.3%
unpow289.3%
unpow289.3%
sin-neg89.3%
sin-neg89.3%
sqr-neg89.3%
unpow289.3%
Simplified99.6%
Taylor expanded in ky around 0 34.4%
associate-/l*36.1%
Simplified36.1%
Taylor expanded in kx around 0 23.5%
associate-/l*25.1%
Simplified25.1%
if 4.3e-114 < ky Initial program 99.7%
associate-*l/96.5%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 38.5%
Final simplification29.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.1e-184) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.1e-184) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.1d-184) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.1e-184) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.1e-184: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.1e-184) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.1e-184) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.1e-184], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.1 \cdot 10^{-184}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.0999999999999999e-184Initial program 90.2%
associate-*l/88.2%
associate-/l*90.1%
unpow290.1%
sqr-neg90.1%
sin-neg90.1%
sin-neg90.1%
unpow290.1%
unpow290.1%
sin-neg90.1%
sin-neg90.1%
sqr-neg90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in ky around 0 34.7%
associate-/l*36.4%
Simplified36.4%
Taylor expanded in th around 0 19.1%
associate-/l*20.7%
Simplified20.7%
Taylor expanded in kx around 0 18.8%
associate-/l*20.5%
Simplified20.5%
if 2.0999999999999999e-184 < ky Initial program 96.7%
associate-*l/91.5%
associate-/l*96.6%
unpow296.6%
sqr-neg96.6%
sin-neg96.6%
sin-neg96.6%
unpow296.6%
unpow296.6%
sin-neg96.6%
sin-neg96.6%
sqr-neg96.6%
unpow296.6%
Simplified99.6%
Taylor expanded in kx around 0 39.1%
Final simplification28.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.5e-174) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.5e-174) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8.5d-174) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.5e-174) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.5e-174: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.5e-174) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.5e-174) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.5e-174], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-174}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 8.4999999999999996e-174Initial program 88.6%
associate-*l/86.6%
associate-/l*88.5%
unpow288.5%
sqr-neg88.5%
sin-neg88.5%
sin-neg88.5%
unpow288.5%
unpow288.5%
sin-neg88.5%
sin-neg88.5%
sqr-neg88.5%
unpow288.5%
Simplified99.6%
Taylor expanded in ky around 0 34.5%
associate-/l*36.1%
Simplified36.1%
Taylor expanded in th around 0 19.3%
associate-/l*20.8%
Simplified20.8%
Taylor expanded in kx around 0 19.0%
associate-/l*20.7%
Simplified20.7%
if 8.4999999999999996e-174 < ky Initial program 99.4%
associate-*l/94.0%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.6%
associate-*r/94.0%
Applied egg-rr94.0%
Taylor expanded in th around 0 50.5%
Taylor expanded in kx around 0 22.5%
Final simplification21.4%
(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 92.9%
associate-*l/89.6%
associate-/l*92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
unpow292.9%
sin-neg92.9%
sin-neg92.9%
sqr-neg92.9%
unpow292.9%
Simplified99.6%
associate-*r/95.1%
Applied egg-rr95.1%
Taylor expanded in th around 0 46.1%
Taylor expanded in kx around 0 14.0%
Final simplification14.0%
herbie shell --seed 2024040
(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)))