
(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 18 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 95.2%
+-commutative95.2%
unpow295.2%
unpow295.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.6)
(/ (fabs (* ky (sin th))) (sin kx))
(if (<= (sin kx) -0.05)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) 5e-32) (sin th) (* (sin th) (/ (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.6) {
tmp = fabs((ky * sin(th))) / sin(kx);
} else if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = sin(th) * (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 (sin(kx) <= (-0.6d0)) then
tmp = abs((ky * sin(th))) / sin(kx)
else if (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.6) {
tmp = Math.abs((ky * Math.sin(th))) / Math.sin(kx);
} else if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.6: tmp = math.fabs((ky * math.sin(th))) / math.sin(kx) elif math.sin(kx) <= -0.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.6) tmp = Float64(abs(Float64(ky * sin(th))) / sin(kx)); elseif (sin(kx) <= -0.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.6) tmp = abs((ky * sin(th))) / sin(kx); elseif (sin(kx) <= -0.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.6], N[(N[Abs[N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.6:\\
\;\;\;\;\frac{\left|ky \cdot \sin th\right|}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.599999999999999978Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in ky around 0 11.8%
add-sqr-sqrt10.0%
sqrt-unprod17.2%
pow217.2%
Applied egg-rr17.2%
unpow217.2%
rem-sqrt-square27.3%
Simplified27.3%
if -0.599999999999999978 < (sin.f64 kx) < -0.050000000000000003Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 13.3%
add-sqr-sqrt11.6%
sqrt-unprod27.1%
pow227.1%
associate-/l*27.1%
Applied egg-rr27.1%
unpow227.1%
rem-sqrt-square35.5%
Simplified35.5%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 60.9%
Final simplification43.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.05)
(fabs (* ky t_1))
(if (<= (sin kx) 5e-32) (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.05) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 5e-32) {
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.05d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 5d-32) 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.05) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 5e-32) {
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.05: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 5e-32: 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.05) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 5e-32) 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.05) tmp = abs((ky * t_1)); elseif (sin(kx) <= 5e-32) 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.05], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], 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.05:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 12.4%
add-sqr-sqrt10.5%
sqrt-unprod22.2%
pow222.2%
associate-/l*22.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square30.1%
Simplified30.1%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 60.9%
Final simplification43.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 5e-32) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = sin(th) * (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 (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 12.4%
add-sqr-sqrt10.5%
sqrt-unprod22.2%
pow222.2%
associate-/l*22.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square30.1%
Simplified30.1%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 60.9%
Final simplification43.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (/ (sin th) (fabs (/ (sin kx) ky))) (if (<= (sin kx) 5e-32) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = sin(th) / fabs((sin(kx) / ky));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = sin(th) * (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 (sin(kx) <= (-0.05d0)) then
tmp = sin(th) / abs((sin(kx) / ky))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.sin(th) / math.fabs((math.sin(kx) / ky)) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = Float64(sin(th) / abs(Float64(sin(kx) / ky))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = sin(th) / abs((sin(kx) / ky)); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.5%
*-commutative99.5%
clear-num99.3%
un-div-inv99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 12.4%
add-sqr-sqrt1.4%
sqrt-unprod22.1%
pow222.1%
Applied egg-rr22.1%
unpow222.1%
rem-sqrt-square31.7%
Simplified31.7%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 60.9%
Final simplification43.3%
(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 95.2%
unpow295.2%
sqr-neg95.2%
sin-neg95.2%
sin-neg95.2%
unpow295.2%
associate-*l/93.0%
associate-/l*95.2%
unpow295.2%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* th (/ ky (sin kx)))) (if (<= (sin kx) 5e-32) (sin th) (* ky (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((th * (ky / sin(kx))));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.05d0)) then
tmp = abs((th * (ky / sin(kx))))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((th * (ky / math.sin(kx)))) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(th * Float64(ky / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((th * (ky / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 12.4%
Taylor expanded in th around 0 11.9%
associate-/l*11.9%
Simplified11.9%
add-sqr-sqrt10.8%
sqrt-unprod12.2%
pow212.2%
clear-num12.2%
un-div-inv12.2%
Applied egg-rr12.2%
unpow212.2%
rem-sqrt-square16.9%
associate-/r/16.9%
rem-square-sqrt13.6%
/-rgt-identity13.6%
associate-*r/13.6%
rem-square-sqrt16.9%
times-frac16.9%
*-commutative16.9%
*-rgt-identity16.9%
associate-/l*16.9%
Simplified16.9%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 52.8%
associate-/l*52.9%
Simplified52.9%
Final simplification37.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (sin kx))))
(if (<= (sin kx) -0.05)
(fabs (* th t_1))
(if (<= (sin kx) 5e-32) (sin th) (* (sin th) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = ky / sin(kx);
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((th * t_1));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = sin(th) * 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 = ky / sin(kx)
if (sin(kx) <= (-0.05d0)) then
tmp = abs((th * t_1))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = sin(th) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((th * t_1));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((th * t_1)) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = math.sin(th) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(ky / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(th * t_1)); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(sin(th) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / sin(kx); tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((th * t_1)); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = sin(th) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(th * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|th \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 12.4%
Taylor expanded in th around 0 11.9%
associate-/l*11.9%
Simplified11.9%
add-sqr-sqrt10.8%
sqrt-unprod12.2%
pow212.2%
clear-num12.2%
un-div-inv12.2%
Applied egg-rr12.2%
unpow212.2%
rem-sqrt-square16.9%
associate-/r/16.9%
rem-square-sqrt13.6%
/-rgt-identity13.6%
associate-*r/13.6%
rem-square-sqrt16.9%
times-frac16.9%
*-commutative16.9%
*-rgt-identity16.9%
associate-/l*16.9%
Simplified16.9%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 52.8%
*-commutative52.8%
associate-/l*52.9%
Simplified52.9%
Final simplification37.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 5e-32) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-32) {
tmp = sin(th);
} else {
tmp = sin(th) * (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 (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-32) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-32) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-32: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-32) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-32], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 12.4%
add-sqr-sqrt10.5%
sqrt-unprod22.2%
pow222.2%
associate-/l*22.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square30.1%
Simplified30.1%
if -0.050000000000000003 < (sin.f64 kx) < 5e-32Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/86.2%
associate-/l*90.6%
unpow290.6%
Simplified99.9%
Taylor expanded in kx around 0 38.3%
if 5e-32 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 52.8%
*-commutative52.8%
associate-/l*52.9%
Simplified52.9%
Final simplification40.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.1) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (/ 1.0 (/ (hypot (sin ky) (sin kx)) (* ky (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.1) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.1) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (ky * Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.1: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (ky * math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.1) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(ky * sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.1) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.1], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky \cdot \sin th}}\\
\end{array}
\end{array}
if th < 0.10000000000000001Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.1%
associate-/l*94.7%
unpow294.7%
Simplified99.7%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 67.6%
associate-*l/67.7%
+-commutative67.7%
unpow267.7%
unpow267.7%
hypot-undefine72.3%
*-lft-identity72.3%
hypot-undefine67.7%
unpow267.7%
unpow267.7%
+-commutative67.7%
unpow267.7%
unpow267.7%
hypot-define72.3%
Simplified72.3%
if 0.10000000000000001 < th Initial program 97.6%
unpow297.6%
sqr-neg97.6%
sin-neg97.6%
sin-neg97.6%
unpow297.6%
associate-*l/97.3%
associate-/l*97.5%
unpow297.5%
Simplified99.6%
associate-*r/99.4%
hypot-undefine97.3%
unpow297.3%
unpow297.3%
+-commutative97.3%
clear-num97.6%
+-commutative97.6%
unpow297.6%
unpow297.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 42.1%
Final simplification66.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.00105) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00105) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / 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 <= 0.00105) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / 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 <= 0.00105: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / 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 <= 0.00105) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / 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 <= 0.00105) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.00105], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $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 0.00105:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if th < 0.00104999999999999994Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.1%
associate-/l*94.7%
unpow294.7%
Simplified99.7%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 67.6%
associate-*l/67.7%
+-commutative67.7%
unpow267.7%
unpow267.7%
hypot-undefine72.3%
*-lft-identity72.3%
hypot-undefine67.7%
unpow267.7%
unpow267.7%
+-commutative67.7%
unpow267.7%
unpow267.7%
hypot-define72.3%
Simplified72.3%
if 0.00104999999999999994 < th Initial program 97.6%
+-commutative97.6%
unpow297.6%
unpow297.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 19.8%
add-sqr-sqrt13.2%
sqrt-unprod12.7%
pow212.7%
Applied egg-rr12.7%
unpow212.7%
rem-sqrt-square19.6%
Simplified19.6%
Final simplification62.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.4e-32) (sin th) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.4e-32) {
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 <= 5.4d-32) 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 <= 5.4e-32) {
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 <= 5.4e-32: 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 <= 5.4e-32) 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 <= 5.4e-32) tmp = sin(th); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.4e-32], 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 5.4 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 5.39999999999999962e-32Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/90.9%
associate-/l*93.7%
unpow293.7%
Simplified99.7%
Taylor expanded in kx around 0 27.5%
if 5.39999999999999962e-32 < kx Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 41.7%
add-sqr-sqrt19.0%
sqrt-unprod27.9%
pow227.9%
Applied egg-rr27.9%
unpow227.9%
rem-sqrt-square34.9%
Simplified34.9%
Final simplification29.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 8.6e-32) (sin th) (if (<= kx 0.25) (/ (sin th) (/ kx ky)) (fabs (* th (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.6e-32) {
tmp = sin(th);
} else if (kx <= 0.25) {
tmp = sin(th) / (kx / ky);
} else {
tmp = fabs((th * (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 <= 8.6d-32) then
tmp = sin(th)
else if (kx <= 0.25d0) then
tmp = sin(th) / (kx / ky)
else
tmp = abs((th * (ky / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.6e-32) {
tmp = Math.sin(th);
} else if (kx <= 0.25) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.abs((th * (ky / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 8.6e-32: tmp = math.sin(th) elif kx <= 0.25: tmp = math.sin(th) / (kx / ky) else: tmp = math.fabs((th * (ky / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 8.6e-32) tmp = sin(th); elseif (kx <= 0.25) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = abs(Float64(th * Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 8.6e-32) tmp = sin(th); elseif (kx <= 0.25) tmp = sin(th) / (kx / ky); else tmp = abs((th * (ky / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 8.6e-32], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 0.25], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 8.6 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 0.25:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 8.5999999999999998e-32Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/90.9%
associate-/l*93.7%
unpow293.7%
Simplified99.7%
Taylor expanded in kx around 0 27.5%
if 8.5999999999999998e-32 < kx < 0.25Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.3%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
associate-*l/99.6%
*-commutative99.6%
clear-num99.8%
un-div-inv99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 85.7%
Taylor expanded in kx around 0 80.4%
if 0.25 < kx Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 31.9%
Taylor expanded in th around 0 24.8%
associate-/l*24.9%
Simplified24.9%
add-sqr-sqrt17.0%
sqrt-unprod15.6%
pow215.6%
clear-num15.6%
un-div-inv15.6%
Applied egg-rr15.6%
unpow215.6%
rem-sqrt-square20.3%
associate-/r/20.3%
rem-square-sqrt12.0%
/-rgt-identity12.0%
associate-*r/12.0%
rem-square-sqrt20.3%
times-frac20.2%
*-commutative20.2%
*-rgt-identity20.2%
associate-/l*20.3%
Simplified20.3%
Final simplification27.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.02e-119) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.02e-119) {
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.02d-119) 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.02e-119) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.02e-119: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.02e-119) 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.02e-119) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.02e-119], 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.02 \cdot 10^{-119}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.02e-119Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/90.7%
associate-/l*92.4%
unpow292.4%
Simplified99.7%
Taylor expanded in ky around 0 29.0%
Taylor expanded in th around 0 19.0%
associate-/l*20.7%
Simplified20.7%
if 1.02e-119 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/96.8%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 32.0%
Final simplification25.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2e-119) (/ 1.0 (/ (/ kx ky) th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2e-119) {
tmp = 1.0 / ((kx / ky) / 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 (ky <= 2d-119) then
tmp = 1.0d0 / ((kx / ky) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2e-119) {
tmp = 1.0 / ((kx / ky) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2e-119: tmp = 1.0 / ((kx / ky) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2e-119) tmp = Float64(1.0 / Float64(Float64(kx / ky) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2e-119) tmp = 1.0 / ((kx / ky) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2e-119], N[(1.0 / N[(N[(kx / ky), $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2 \cdot 10^{-119}:\\
\;\;\;\;\frac{1}{\frac{\frac{kx}{ky}}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.00000000000000003e-119Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/90.7%
associate-/l*92.4%
unpow292.4%
Simplified99.7%
Taylor expanded in ky around 0 29.0%
Taylor expanded in th around 0 19.0%
associate-/l*20.7%
Simplified20.7%
Taylor expanded in kx around 0 16.3%
associate-*r/14.5%
clear-num14.5%
Applied egg-rr14.5%
associate-/r*16.3%
Simplified16.3%
if 2.00000000000000003e-119 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/96.8%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 32.0%
Final simplification22.4%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (/ (/ kx ky) th)))
double code(double kx, double ky, double th) {
return 1.0 / ((kx / ky) / th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((kx / ky) / th)
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((kx / ky) / th);
}
def code(kx, ky, th): return 1.0 / ((kx / ky) / th)
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(kx / ky) / th)) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((kx / ky) / th); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(kx / ky), $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\frac{kx}{ky}}{th}}
\end{array}
Initial program 95.2%
unpow295.2%
sqr-neg95.2%
sin-neg95.2%
sin-neg95.2%
unpow295.2%
associate-*l/93.0%
associate-/l*95.2%
unpow295.2%
Simplified99.7%
Taylor expanded in ky around 0 23.1%
Taylor expanded in th around 0 15.8%
associate-/l*16.8%
Simplified16.8%
Taylor expanded in kx around 0 13.0%
associate-*r/11.8%
clear-num11.8%
Applied egg-rr11.8%
associate-/r*12.9%
Simplified12.9%
Final simplification12.9%
(FPCore (kx ky th) :precision binary64 (* ky (/ th kx)))
double code(double kx, double ky, double th) {
return ky * (th / kx);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = ky * (th / kx)
end function
public static double code(double kx, double ky, double th) {
return ky * (th / kx);
}
def code(kx, ky, th): return ky * (th / kx)
function code(kx, ky, th) return Float64(ky * Float64(th / kx)) end
function tmp = code(kx, ky, th) tmp = ky * (th / kx); end
code[kx_, ky_, th_] := N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ky \cdot \frac{th}{kx}
\end{array}
Initial program 95.2%
unpow295.2%
sqr-neg95.2%
sin-neg95.2%
sin-neg95.2%
unpow295.2%
associate-*l/93.0%
associate-/l*95.2%
unpow295.2%
Simplified99.7%
Taylor expanded in ky around 0 23.1%
Taylor expanded in th around 0 15.8%
associate-/l*16.8%
Simplified16.8%
Taylor expanded in kx around 0 13.0%
Final simplification13.0%
(FPCore (kx ky th) :precision binary64 (* th (/ ky kx)))
double code(double kx, double ky, double th) {
return th * (ky / kx);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th * (ky / kx)
end function
public static double code(double kx, double ky, double th) {
return th * (ky / kx);
}
def code(kx, ky, th): return th * (ky / kx)
function code(kx, ky, th) return Float64(th * Float64(ky / kx)) end
function tmp = code(kx, ky, th) tmp = th * (ky / kx); end
code[kx_, ky_, th_] := N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
th \cdot \frac{ky}{kx}
\end{array}
Initial program 95.2%
unpow295.2%
sqr-neg95.2%
sin-neg95.2%
sin-neg95.2%
unpow295.2%
associate-*l/93.0%
associate-/l*95.2%
unpow295.2%
Simplified99.7%
Taylor expanded in ky around 0 23.1%
Taylor expanded in th around 0 15.8%
associate-/l*16.8%
Simplified16.8%
Taylor expanded in kx around 0 13.0%
Taylor expanded in ky around 0 11.8%
associate-*l/12.9%
Simplified12.9%
Final simplification12.9%
herbie shell --seed 2024082
(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)))