
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 94.8%
associate-*l/92.4%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.5%
associate-*r/95.2%
hypot-undefine92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
associate-*l/94.8%
*-commutative94.8%
clear-num94.8%
un-div-inv94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.015)
(fabs (sin th))
(if (<= (sin ky) 2e-59)
(* (sin th) (/ ky (sin kx)))
(if (<= (sin ky) 2e-20) (fabs (* ky (/ (sin th) (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.015) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-59) {
tmp = sin(th) * (ky / sin(kx));
} else if (sin(ky) <= 2e-20) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.015d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-59) then
tmp = sin(th) * (ky / sin(kx))
else if (sin(ky) <= 2d-20) then
tmp = abs((ky * (sin(th) / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.015) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-59) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.015: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-59: tmp = math.sin(th) * (ky / math.sin(kx)) elif math.sin(ky) <= 2e-20: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-59) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (sin(ky) <= 2e-20) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-59) tmp = sin(th) * (ky / sin(kx)); elseif (sin(ky) <= 2e-20) tmp = abs((ky * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.015], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.015:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.014999999999999999Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod14.0%
pow214.0%
clear-num14.0%
un-div-inv14.1%
Applied egg-rr14.1%
unpow214.1%
rem-sqrt-square21.4%
associate-/r/21.5%
*-inverses21.5%
*-lft-identity21.5%
Simplified21.5%
if -0.014999999999999999 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 89.3%
associate-*l/84.3%
associate-/l*89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
unpow289.2%
sin-neg89.2%
sin-neg89.2%
sqr-neg89.2%
unpow289.2%
Simplified99.6%
associate-*r/90.3%
hypot-undefine84.3%
unpow284.3%
unpow284.3%
+-commutative84.3%
associate-*l/89.3%
*-commutative89.3%
clear-num89.2%
un-div-inv89.3%
+-commutative89.3%
unpow289.3%
unpow289.3%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 48.2%
associate-/r/48.3%
clear-num48.2%
remove-double-div48.3%
*-commutative48.3%
Applied egg-rr48.3%
if 2.0000000000000001e-59 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 99.6%
associate-*l/99.4%
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%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in ky around 0 40.1%
add-sqr-sqrt26.5%
sqrt-unprod41.4%
pow241.4%
associate-/r/41.4%
clear-num41.6%
remove-double-div41.4%
Applied egg-rr41.4%
unpow241.4%
rem-sqrt-square53.0%
*-commutative53.0%
associate-*l/53.0%
associate-*r/53.0%
Simplified53.0%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification44.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 2e-59)
(* (sin th) (/ ky (sin kx)))
(if (<= (sin ky) 2e-20) (fabs (* ky (/ (sin th) (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 2e-59) {
tmp = sin(th) * (ky / sin(kx));
} else if (sin(ky) <= 2e-20) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 2d-59) then
tmp = sin(th) * (ky / sin(kx))
else if (sin(ky) <= 2d-20) then
tmp = abs((ky * (sin(th) / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-59) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 2e-59: tmp = math.sin(th) * (ky / math.sin(kx)) elif math.sin(ky) <= 2e-20: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-59) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (sin(ky) <= 2e-20) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 2e-59) tmp = sin(th) * (ky / sin(kx)); elseif (sin(ky) <= 2e-20) tmp = abs((ky * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square33.6%
Simplified33.6%
Taylor expanded in th around 0 16.4%
if -0.0100000000000000002 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 89.2%
associate-*l/84.2%
associate-/l*89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
unpow289.1%
sin-neg89.1%
sin-neg89.1%
sqr-neg89.1%
unpow289.1%
Simplified99.6%
associate-*r/90.2%
hypot-undefine84.2%
unpow284.2%
unpow284.2%
+-commutative84.2%
associate-*l/89.2%
*-commutative89.2%
clear-num89.1%
un-div-inv89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 48.6%
associate-/r/48.7%
clear-num48.6%
remove-double-div48.7%
*-commutative48.7%
Applied egg-rr48.7%
if 2.0000000000000001e-59 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 99.6%
associate-*l/99.4%
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%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in ky around 0 40.1%
add-sqr-sqrt26.5%
sqrt-unprod41.4%
pow241.4%
associate-/r/41.4%
clear-num41.6%
remove-double-div41.4%
Applied egg-rr41.4%
unpow241.4%
rem-sqrt-square53.0%
*-commutative53.0%
associate-*l/53.0%
associate-*r/53.0%
Simplified53.0%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification43.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin ky) -0.05)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 1e-62)
(* (sin ky) t_1)
(if (<= (sin ky) 2e-20) (fabs (* ky t_1)) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-62) {
tmp = sin(ky) * t_1;
} else if (sin(ky) <= 2e-20) {
tmp = fabs((ky * t_1));
} 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) :: t_1
real(8) :: tmp
t_1 = sin(th) / sin(kx)
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-62) then
tmp = sin(ky) * t_1
else if (sin(ky) <= 2d-20) then
tmp = abs((ky * t_1))
else
tmp = sin(th)
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(ky) <= -0.05) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-62) {
tmp = Math.sin(ky) * t_1;
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.abs((ky * t_1));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-62: tmp = math.sin(ky) * t_1 elif math.sin(ky) <= 2e-20: tmp = math.fabs((ky * t_1)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-62) tmp = Float64(sin(ky) * t_1); elseif (sin(ky) <= 2e-20) tmp = abs(Float64(ky * t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-62) tmp = sin(ky) * t_1; elseif (sin(ky) <= 2e-20) tmp = abs((ky * t_1)); else tmp = sin(th); 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[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-62], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-62}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.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 kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square34.5%
Simplified34.5%
Taylor expanded in th around 0 16.7%
if -0.050000000000000003 < (sin.f64 ky) < 1e-62Initial program 89.4%
associate-*l/84.5%
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 48.3%
if 1e-62 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 99.6%
associate-*l/99.4%
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%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in ky around 0 40.1%
add-sqr-sqrt26.5%
sqrt-unprod41.4%
pow241.4%
associate-/r/41.4%
clear-num41.6%
remove-double-div41.4%
Applied egg-rr41.4%
unpow241.4%
rem-sqrt-square53.0%
*-commutative53.0%
associate-*l/53.0%
associate-*r/53.0%
Simplified53.0%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification43.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 2e-59)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= (sin ky) 2e-20) (fabs (* ky (/ (sin th) (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 2e-59) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 2e-20) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 2d-59) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 2d-20) then
tmp = abs((ky * (sin(th) / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-59) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 2e-59: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 2e-20: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-59) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 2e-20) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 2e-59) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 2e-20) tmp = abs((ky * (sin(th) / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.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 kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square34.5%
Simplified34.5%
Taylor expanded in th around 0 16.7%
if -0.050000000000000003 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 89.4%
associate-*l/84.5%
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%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.3%
if 2.0000000000000001e-59 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 99.6%
associate-*l/99.4%
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%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in ky around 0 40.1%
add-sqr-sqrt26.5%
sqrt-unprod41.4%
pow241.4%
associate-/r/41.4%
clear-num41.6%
remove-double-div41.4%
Applied egg-rr41.4%
unpow241.4%
rem-sqrt-square53.0%
*-commutative53.0%
associate-*l/53.0%
associate-*r/53.0%
Simplified53.0%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification43.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 2e-20)
(/ (sin th) (/ 1.0 (fabs (/ ky (sin kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 2e-20) {
tmp = sin(th) / (1.0 / fabs((ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 2d-20) then
tmp = sin(th) / (1.0d0 / abs((ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.sin(th) / (1.0 / Math.abs((ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 2e-20: tmp = math.sin(th) / (1.0 / math.fabs((ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-20) tmp = Float64(sin(th) / Float64(1.0 / abs(Float64(ky / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 2e-20) tmp = sin(th) / (1.0 / abs((ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[(N[Sin[th], $MachinePrecision] / N[(1.0 / N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\frac{\sin th}{\frac{1}{\left|\frac{ky}{\sin kx}\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square33.6%
Simplified33.6%
Taylor expanded in th around 0 16.4%
if -0.0100000000000000002 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 89.9%
associate-*l/85.2%
associate-/l*89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
unpow289.8%
sin-neg89.8%
sin-neg89.8%
sqr-neg89.8%
unpow289.8%
Simplified99.6%
associate-*r/90.8%
hypot-undefine85.2%
unpow285.2%
unpow285.2%
+-commutative85.2%
associate-*l/89.9%
*-commutative89.9%
clear-num89.8%
un-div-inv89.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 48.1%
add-sqr-sqrt26.8%
sqrt-unprod43.9%
pow243.9%
Applied egg-rr43.9%
unpow243.9%
rem-sqrt-square52.9%
Simplified52.9%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 2e-20)
(/ (sin th) (/ 1.0 (fabs (/ ky (sin kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 2e-20) {
tmp = sin(th) / (1.0 / fabs((ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 2d-20) then
tmp = sin(th) / (1.0d0 / abs((ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-20) {
tmp = Math.sin(th) / (1.0 / Math.abs((ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 2e-20: tmp = math.sin(th) / (1.0 / math.fabs((ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 2e-20) tmp = Float64(sin(th) / Float64(1.0 / abs(Float64(ky / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 2e-20) tmp = sin(th) / (1.0 / abs((ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-20], N[(N[Sin[th], $MachinePrecision] / N[(1.0 / N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\frac{\sin th}{\frac{1}{\left|\frac{ky}{\sin kx}\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square33.6%
Simplified33.6%
if -0.0100000000000000002 < (sin.f64 ky) < 1.99999999999999989e-20Initial program 89.9%
associate-*l/85.2%
associate-/l*89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
unpow289.8%
sin-neg89.8%
sin-neg89.8%
sqr-neg89.8%
unpow289.8%
Simplified99.6%
associate-*r/90.8%
hypot-undefine85.2%
unpow285.2%
unpow285.2%
+-commutative85.2%
associate-*l/89.9%
*-commutative89.9%
clear-num89.8%
un-div-inv89.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 48.1%
add-sqr-sqrt26.8%
sqrt-unprod43.9%
pow243.9%
Applied egg-rr43.9%
unpow243.9%
rem-sqrt-square52.9%
Simplified52.9%
if 1.99999999999999989e-20 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 kx around 0 54.4%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 1e-69)
(/ (sin ky) (/ (sin kx) (sin th)))
(/ (* (sin th) (sin ky)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-69) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else {
tmp = (sin(th) * sin(ky)) / 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(ky) <= (-0.05d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-69) then
tmp = sin(ky) / (sin(kx) / sin(th))
else
tmp = (sin(th) * sin(ky)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else {
tmp = (Math.sin(th) * Math.sin(ky)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-69: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) else: tmp = (math.sin(th) * math.sin(ky)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); else tmp = Float64(Float64(sin(th) * sin(ky)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = (sin(th) * sin(ky)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot \sin ky}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.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 kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square34.5%
Simplified34.5%
Taylor expanded in th around 0 16.7%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 89.3%
associate-*l/84.3%
associate-/l*89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
unpow289.2%
sin-neg89.2%
sin-neg89.2%
sqr-neg89.2%
unpow289.2%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.7%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
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 52.2%
*-commutative52.2%
associate-*l/52.1%
Applied egg-rr52.1%
Final simplification42.7%
(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 94.8%
associate-*l/92.4%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.5%
Final simplification99.5%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 54000.0)
(/
(sin ky)
(* (hypot (sin ky) (sin kx)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (or (<= th 1.6e+245) (not (<= th 3.9e+284)))
(/ (sin th) (/ 1.0 (fabs (/ ky (sin kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 54000.0) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if ((th <= 1.6e+245) || !(th <= 3.9e+284)) {
tmp = sin(th) / (1.0 / fabs((ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 54000.0) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if ((th <= 1.6e+245) || !(th <= 3.9e+284)) {
tmp = Math.sin(th) / (1.0 / Math.abs((ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 54000.0: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))) elif (th <= 1.6e+245) or not (th <= 3.9e+284): tmp = math.sin(th) / (1.0 / math.fabs((ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 54000.0) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif ((th <= 1.6e+245) || !(th <= 3.9e+284)) tmp = Float64(sin(th) / Float64(1.0 / abs(Float64(ky / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 54000.0) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif ((th <= 1.6e+245) || ~((th <= 3.9e+284))) tmp = sin(th) / (1.0 / abs((ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 54000.0], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 1.6e+245], N[Not[LessEqual[th, 3.9e+284]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] / N[(1.0 / N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 54000:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;th \leq 1.6 \cdot 10^{+245} \lor \neg \left(th \leq 3.9 \cdot 10^{+284}\right):\\
\;\;\;\;\frac{\sin th}{\frac{1}{\left|\frac{ky}{\sin kx}\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 54000Initial program 94.9%
associate-*l/91.6%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 60.4%
+-commutative60.4%
+-commutative60.4%
unpow260.4%
unpow260.4%
hypot-undefine63.8%
associate-*r*63.8%
+-commutative63.8%
unpow263.8%
unpow263.8%
hypot-undefine63.8%
distribute-rgt-out63.8%
Simplified63.8%
if 54000 < th < 1.60000000000000012e245 or 3.89999999999999976e284 < th Initial program 93.8%
associate-*l/93.8%
associate-/l*93.7%
unpow293.7%
sqr-neg93.7%
sin-neg93.7%
sin-neg93.7%
unpow293.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
sqr-neg93.7%
unpow293.7%
Simplified99.4%
associate-*r/99.4%
hypot-undefine93.8%
unpow293.8%
unpow293.8%
+-commutative93.8%
associate-*l/93.8%
*-commutative93.8%
clear-num93.9%
un-div-inv93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.5%
inv-pow99.5%
Applied egg-rr99.5%
unpow-199.5%
Simplified99.5%
Taylor expanded in ky around 0 30.5%
add-sqr-sqrt13.9%
sqrt-unprod17.8%
pow217.8%
Applied egg-rr17.8%
unpow217.8%
rem-sqrt-square26.4%
Simplified26.4%
if 1.60000000000000012e245 < th < 3.89999999999999976e284Initial program 99.7%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 11.5%
Final simplification54.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.015) (fabs (sin th)) (if (<= (sin ky) 2e-87) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.015) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-87) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.015d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-87) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.015) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-87) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.015: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-87: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-87) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-87) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.015], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-87], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.015:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-87}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.014999999999999999Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod14.0%
pow214.0%
clear-num14.0%
un-div-inv14.1%
Applied egg-rr14.1%
unpow214.1%
rem-sqrt-square21.4%
associate-/r/21.5%
*-inverses21.5%
*-lft-identity21.5%
Simplified21.5%
if -0.014999999999999999 < (sin.f64 ky) < 2.00000000000000004e-87Initial program 88.8%
associate-*l/84.3%
associate-/l*88.7%
unpow288.7%
sqr-neg88.7%
sin-neg88.7%
sin-neg88.7%
unpow288.7%
unpow288.7%
sin-neg88.7%
sin-neg88.7%
sqr-neg88.7%
unpow288.7%
Simplified99.6%
Taylor expanded in ky around 0 46.1%
associate-/l*48.1%
Simplified48.1%
if 2.00000000000000004e-87 < (sin.f64 ky) Initial program 99.7%
associate-*l/98.5%
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 kx around 0 50.7%
Final simplification43.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.015) (fabs (sin th)) (if (<= (sin ky) 2e-87) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.015) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-87) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.015d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-87) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.015) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-87) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.015: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-87: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-87) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.015) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-87) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.015], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-87], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.015:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.014999999999999999Initial program 99.6%
associate-*l/99.5%
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 kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod14.0%
pow214.0%
clear-num14.0%
un-div-inv14.1%
Applied egg-rr14.1%
unpow214.1%
rem-sqrt-square21.4%
associate-/r/21.5%
*-inverses21.5%
*-lft-identity21.5%
Simplified21.5%
if -0.014999999999999999 < (sin.f64 ky) < 2.00000000000000004e-87Initial program 88.8%
associate-*l/84.3%
associate-/l*88.7%
unpow288.7%
sqr-neg88.7%
sin-neg88.7%
sin-neg88.7%
unpow288.7%
unpow288.7%
sin-neg88.7%
sin-neg88.7%
sqr-neg88.7%
unpow288.7%
Simplified99.6%
associate-*r/90.6%
hypot-undefine84.3%
unpow284.3%
unpow284.3%
+-commutative84.3%
associate-*l/88.8%
*-commutative88.8%
clear-num88.6%
un-div-inv88.7%
+-commutative88.7%
unpow288.7%
unpow288.7%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
Simplified99.7%
Taylor expanded in ky around 0 48.1%
associate-/r/48.1%
clear-num48.0%
remove-double-div48.1%
*-commutative48.1%
Applied egg-rr48.1%
if 2.00000000000000004e-87 < (sin.f64 ky) Initial program 99.7%
associate-*l/98.5%
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 kx around 0 50.7%
Final simplification43.0%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0015)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (or (<= th 1.2e+245) (not (<= th 4.2e+284)))
(/ (sin th) (/ 1.0 (fabs (/ ky (sin kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0015) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if ((th <= 1.2e+245) || !(th <= 4.2e+284)) {
tmp = sin(th) / (1.0 / fabs((ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0015) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 1.2e+245) || !(th <= 4.2e+284)) {
tmp = Math.sin(th) / (1.0 / Math.abs((ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0015: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 1.2e+245) or not (th <= 4.2e+284): tmp = math.sin(th) / (1.0 / math.fabs((ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0015) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif ((th <= 1.2e+245) || !(th <= 4.2e+284)) tmp = Float64(sin(th) / Float64(1.0 / abs(Float64(ky / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0015) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif ((th <= 1.2e+245) || ~((th <= 4.2e+284))) tmp = sin(th) / (1.0 / abs((ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0015], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 1.2e+245], N[Not[LessEqual[th, 4.2e+284]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] / N[(1.0 / N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0015:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 1.2 \cdot 10^{+245} \lor \neg \left(th \leq 4.2 \cdot 10^{+284}\right):\\
\;\;\;\;\frac{\sin th}{\frac{1}{\left|\frac{ky}{\sin kx}\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.0015Initial program 94.7%
associate-*l/91.5%
associate-/l*94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
unpow294.6%
sin-neg94.6%
sin-neg94.6%
sqr-neg94.6%
unpow294.6%
Simplified99.6%
clear-num99.4%
hypot-undefine94.5%
unpow294.5%
unpow294.5%
+-commutative94.5%
associate-/r/94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-undefine99.5%
Applied egg-rr99.5%
associate-*l/99.6%
*-un-lft-identity99.6%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 59.6%
associate-*l/59.7%
+-commutative59.7%
unpow259.7%
unpow259.7%
hypot-undefine63.1%
*-lft-identity63.1%
Simplified63.1%
clear-num63.3%
div-inv63.2%
Applied egg-rr63.2%
associate-*r/63.3%
*-rgt-identity63.3%
Simplified63.3%
if 0.0015 < th < 1.1999999999999999e245 or 4.2000000000000001e284 < th Initial program 94.2%
associate-*l/94.2%
associate-/l*94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
sqr-neg94.2%
unpow294.2%
Simplified99.4%
associate-*r/99.4%
hypot-undefine94.2%
unpow294.2%
unpow294.2%
+-commutative94.2%
associate-*l/94.2%
*-commutative94.2%
clear-num94.3%
un-div-inv94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.5%
inv-pow99.5%
Applied egg-rr99.5%
unpow-199.5%
Simplified99.5%
Taylor expanded in ky around 0 31.9%
add-sqr-sqrt14.8%
sqrt-unprod18.5%
pow218.5%
Applied egg-rr18.5%
unpow218.5%
rem-sqrt-square26.5%
Simplified26.5%
if 1.1999999999999999e245 < th < 4.2000000000000001e284Initial program 99.7%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 11.5%
Final simplification53.0%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0015)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (or (<= th 1.2e+245) (not (<= th 4.2e+284)))
(/ (sin th) (/ 1.0 (fabs (/ ky (sin kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0015) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if ((th <= 1.2e+245) || !(th <= 4.2e+284)) {
tmp = sin(th) / (1.0 / fabs((ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0015) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 1.2e+245) || !(th <= 4.2e+284)) {
tmp = Math.sin(th) / (1.0 / Math.abs((ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0015: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 1.2e+245) or not (th <= 4.2e+284): tmp = math.sin(th) / (1.0 / math.fabs((ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0015) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif ((th <= 1.2e+245) || !(th <= 4.2e+284)) tmp = Float64(sin(th) / Float64(1.0 / abs(Float64(ky / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0015) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif ((th <= 1.2e+245) || ~((th <= 4.2e+284))) tmp = sin(th) / (1.0 / abs((ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0015], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 1.2e+245], N[Not[LessEqual[th, 4.2e+284]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] / N[(1.0 / N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0015:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 1.2 \cdot 10^{+245} \lor \neg \left(th \leq 4.2 \cdot 10^{+284}\right):\\
\;\;\;\;\frac{\sin th}{\frac{1}{\left|\frac{ky}{\sin kx}\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.0015Initial program 94.7%
associate-*l/91.5%
associate-/l*94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
unpow294.6%
sin-neg94.6%
sin-neg94.6%
sqr-neg94.6%
unpow294.6%
Simplified99.6%
clear-num99.4%
hypot-undefine94.5%
unpow294.5%
unpow294.5%
+-commutative94.5%
associate-/r/94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-undefine99.5%
Applied egg-rr99.5%
associate-*l/99.6%
*-un-lft-identity99.6%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 59.6%
associate-*l/59.7%
+-commutative59.7%
unpow259.7%
unpow259.7%
hypot-undefine63.1%
*-lft-identity63.1%
Simplified63.1%
un-div-inv63.2%
Applied egg-rr63.2%
associate-/r/63.3%
Simplified63.3%
if 0.0015 < th < 1.1999999999999999e245 or 4.2000000000000001e284 < th Initial program 94.2%
associate-*l/94.2%
associate-/l*94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
sqr-neg94.2%
unpow294.2%
Simplified99.4%
associate-*r/99.4%
hypot-undefine94.2%
unpow294.2%
unpow294.2%
+-commutative94.2%
associate-*l/94.2%
*-commutative94.2%
clear-num94.3%
un-div-inv94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.5%
inv-pow99.5%
Applied egg-rr99.5%
unpow-199.5%
Simplified99.5%
Taylor expanded in ky around 0 31.9%
add-sqr-sqrt14.8%
sqrt-unprod18.5%
pow218.5%
Applied egg-rr18.5%
unpow218.5%
rem-sqrt-square26.5%
Simplified26.5%
if 1.1999999999999999e245 < th < 4.2000000000000001e284Initial program 99.7%
associate-*l/99.7%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 11.5%
Final simplification53.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 1.45e-89)
(/ (sin th) (/ kx ky))
(if (or (<= ky 15000000000000.0) (not (<= ky 5.8e+211)))
(sin th)
(fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-89) {
tmp = sin(th) / (kx / ky);
} else if ((ky <= 15000000000000.0) || !(ky <= 5.8e+211)) {
tmp = sin(th);
} else {
tmp = fabs(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.45d-89) then
tmp = sin(th) / (kx / ky)
else if ((ky <= 15000000000000.0d0) .or. (.not. (ky <= 5.8d+211))) then
tmp = sin(th)
else
tmp = abs(sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-89) {
tmp = Math.sin(th) / (kx / ky);
} else if ((ky <= 15000000000000.0) || !(ky <= 5.8e+211)) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.45e-89: tmp = math.sin(th) / (kx / ky) elif (ky <= 15000000000000.0) or not (ky <= 5.8e+211): tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.45e-89) tmp = Float64(sin(th) / Float64(kx / ky)); elseif ((ky <= 15000000000000.0) || !(ky <= 5.8e+211)) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.45e-89) tmp = sin(th) / (kx / ky); elseif ((ky <= 15000000000000.0) || ~((ky <= 5.8e+211))) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.45e-89], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 15000000000000.0], N[Not[LessEqual[ky, 5.8e+211]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.45 \cdot 10^{-89}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{elif}\;ky \leq 15000000000000 \lor \neg \left(ky \leq 5.8 \cdot 10^{+211}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 1.44999999999999996e-89Initial program 92.5%
associate-*l/89.4%
associate-/l*92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
sqr-neg92.4%
unpow292.4%
Simplified99.6%
associate-*r/93.6%
hypot-undefine89.4%
unpow289.4%
unpow289.4%
+-commutative89.4%
associate-*l/92.5%
*-commutative92.5%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 32.8%
Taylor expanded in kx around 0 24.5%
if 1.44999999999999996e-89 < ky < 1.5e13 or 5.8000000000000001e211 < ky Initial program 99.5%
associate-*l/97.3%
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.4%
Taylor expanded in kx around 0 27.2%
if 1.5e13 < ky < 5.8000000000000001e211Initial program 99.8%
associate-*l/99.7%
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 37.3%
add-sqr-sqrt14.5%
sqrt-unprod13.3%
pow213.3%
clear-num13.3%
un-div-inv13.3%
Applied egg-rr13.3%
unpow213.3%
rem-sqrt-square19.9%
associate-/r/19.9%
*-inverses19.9%
*-lft-identity19.9%
Simplified19.9%
Final simplification24.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.45e+15) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.45e+15) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 3.45d+15) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.45e+15) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.45e+15: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.45e+15) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.45e+15) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.45e+15], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.45 \cdot 10^{+15}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.45e15Initial program 93.2%
associate-*l/89.9%
associate-/l*93.0%
unpow293.0%
sqr-neg93.0%
sin-neg93.0%
sin-neg93.0%
unpow293.0%
unpow293.0%
sin-neg93.0%
sin-neg93.0%
sqr-neg93.0%
unpow293.0%
Simplified99.6%
Taylor expanded in kx around 0 27.0%
if 3.45e15 < kx Initial program 99.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.5%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.5%
*-commutative99.5%
clear-num99.5%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.4%
inv-pow99.4%
Applied egg-rr99.4%
unpow-199.4%
Simplified99.4%
Taylor expanded in ky around 0 26.9%
Taylor expanded in th around 0 19.6%
associate-/l*19.7%
Simplified19.7%
Final simplification25.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.3e-90) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.3e-90) {
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 <= 2.3d-90) 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 <= 2.3e-90) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.3e-90: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.3e-90) 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 <= 2.3e-90) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.3e-90], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.3 \cdot 10^{-90}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.2999999999999998e-90Initial program 92.5%
associate-*l/89.4%
associate-/l*92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
sqr-neg92.4%
unpow292.4%
Simplified99.6%
associate-*r/93.6%
hypot-undefine89.4%
unpow289.4%
unpow289.4%
+-commutative89.4%
associate-*l/92.5%
*-commutative92.5%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 32.8%
Taylor expanded in kx around 0 23.2%
associate-/l*24.5%
Simplified24.5%
if 2.2999999999999998e-90 < ky Initial program 99.6%
associate-*l/98.5%
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 kx around 0 32.3%
Final simplification27.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.55e-88) (/ (sin th) (/ kx ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.55e-88) {
tmp = sin(th) / (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 (ky <= 1.55d-88) then
tmp = sin(th) / (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 (ky <= 1.55e-88) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.55e-88: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.55e-88) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.55e-88) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.55e-88], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.55 \cdot 10^{-88}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.5499999999999999e-88Initial program 92.5%
associate-*l/89.4%
associate-/l*92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
unpow292.4%
sin-neg92.4%
sin-neg92.4%
sqr-neg92.4%
unpow292.4%
Simplified99.6%
associate-*r/93.6%
hypot-undefine89.4%
unpow289.4%
unpow289.4%
+-commutative89.4%
associate-*l/92.5%
*-commutative92.5%
clear-num92.3%
un-div-inv92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 32.8%
Taylor expanded in kx around 0 24.5%
if 1.5499999999999999e-88 < ky Initial program 99.6%
associate-*l/98.5%
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 kx around 0 32.3%
Final simplification27.1%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.8%
associate-*l/92.4%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.5%
Taylor expanded in kx around 0 22.7%
Final simplification22.7%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))))
double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
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 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
def code(kx, ky, th): return 1.0 / ((1.0 / th) + (th * 0.16666666666666666))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}
\end{array}
Initial program 94.8%
associate-*l/92.4%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.5%
Taylor expanded in kx around 0 22.6%
add-sqr-sqrt11.0%
sqrt-unprod20.2%
pow220.2%
Applied egg-rr20.2%
unpow220.2%
rem-sqrt-square22.5%
Simplified22.5%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt22.6%
clear-num22.6%
div-inv22.6%
div-inv22.6%
associate-/r*22.6%
*-inverses22.6%
Applied egg-rr22.6%
Taylor expanded in th around 0 15.1%
Final simplification15.1%
(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 94.8%
associate-*l/92.4%
associate-/l*94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
sqr-neg94.7%
unpow294.7%
Simplified99.5%
Taylor expanded in kx around 0 22.6%
Taylor expanded in th around 0 14.2%
Final simplification14.2%
herbie shell --seed 2024047
(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)))