
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 91.6%
remove-double-neg91.6%
sin-neg91.6%
neg-mul-191.6%
*-commutative91.6%
associate-*l*91.6%
associate-*l/90.7%
associate-/r/90.7%
associate-*l/91.6%
associate-/r/91.6%
sin-neg91.6%
neg-mul-191.6%
associate-/r*91.6%
associate-/r/91.6%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.0362)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 2e-223)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (or (<= (sin ky) 1e-85)
(and (not (<= (sin ky) 1e-49)) (<= (sin ky) 4e-23)))
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0362) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 2e-223) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if ((sin(ky) <= 1e-85) || (!(sin(ky) <= 1e-49) && (sin(ky) <= 4e-23))) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0362d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 2d-223) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if ((sin(ky) <= 1d-85) .or. (.not. (sin(ky) <= 1d-49)) .and. (sin(ky) <= 4d-23)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0362) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-223) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if ((Math.sin(ky) <= 1e-85) || (!(Math.sin(ky) <= 1e-49) && (Math.sin(ky) <= 4e-23))) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0362: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 2e-223: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif (math.sin(ky) <= 1e-85) or (not (math.sin(ky) <= 1e-49) and (math.sin(ky) <= 4e-23)): tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0362) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-223) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif ((sin(ky) <= 1e-85) || (!(sin(ky) <= 1e-49) && (sin(ky) <= 4e-23))) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0362) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 2e-223) tmp = sin(ky) / (sin(kx) / sin(th)); elseif ((sin(ky) <= 1e-85) || (~((sin(ky) <= 1e-49)) && (sin(ky) <= 4e-23))) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0362], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-223], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-85], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-49]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 4e-23]]], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0362:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-223}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-85} \lor \neg \left(\sin ky \leq 10^{-49}\right) \land \sin ky \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.036200000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef41.8%
hypot-udef41.7%
unpow241.7%
unpow241.7%
+-commutative41.7%
unpow241.7%
unpow241.7%
hypot-def41.8%
Applied egg-rr41.8%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod27.6%
pow227.6%
Applied egg-rr27.6%
unpow227.6%
rem-sqrt-square37.9%
Simplified37.9%
Taylor expanded in th around 0 27.4%
if -0.036200000000000003 < (sin.f64 ky) < 1.9999999999999999e-223Initial program 81.2%
Taylor expanded in ky around 0 52.7%
associate-*l/50.2%
associate-/l*52.7%
Applied egg-rr52.7%
if 1.9999999999999999e-223 < (sin.f64 ky) < 9.9999999999999998e-86 or 9.99999999999999936e-50 < (sin.f64 ky) < 3.99999999999999984e-23Initial program 90.7%
Taylor expanded in ky around 0 36.5%
add-sqr-sqrt29.6%
sqrt-unprod30.2%
pow230.2%
*-commutative30.2%
Applied egg-rr30.2%
unpow230.2%
rem-sqrt-square63.4%
Simplified63.4%
if 9.9999999999999998e-86 < (sin.f64 ky) < 9.99999999999999936e-50 or 3.99999999999999984e-23 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 57.9%
Final simplification49.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (fabs (/ (sin ky) (sin kx))))))
(if (<= (sin th) -0.05)
t_1
(if (<= (sin th) 0.0005)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin th) 0.35)
t_1
(* (sin ky) (fabs (/ (sin th) (sin ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * fabs((sin(ky) / sin(kx)));
double tmp;
if (sin(th) <= -0.05) {
tmp = t_1;
} else if (sin(th) <= 0.0005) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(th) <= 0.35) {
tmp = t_1;
} else {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = t_1;
} else if (Math.sin(th) <= 0.0005) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(th) <= 0.35) {
tmp = t_1;
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) tmp = 0 if math.sin(th) <= -0.05: tmp = t_1 elif math.sin(th) <= 0.0005: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(th) <= 0.35: tmp = t_1 else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))) tmp = 0.0 if (sin(th) <= -0.05) tmp = t_1; elseif (sin(th) <= 0.0005) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(th) <= 0.35) tmp = t_1; else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * abs((sin(ky) / sin(kx))); tmp = 0.0; if (sin(th) <= -0.05) tmp = t_1; elseif (sin(th) <= 0.0005) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(th) <= 0.35) tmp = t_1; else tmp = sin(ky) * abs((sin(th) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], t$95$1, If[LessEqual[N[Sin[th], $MachinePrecision], 0.0005], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.35], t$95$1, N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin th \leq 0.0005:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin th \leq 0.35:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003 or 5.0000000000000001e-4 < (sin.f64 th) < 0.34999999999999998Initial program 93.9%
Taylor expanded in ky around 0 21.2%
add-sqr-sqrt5.0%
sqrt-unprod11.6%
pow211.6%
Applied egg-rr11.6%
unpow211.6%
rem-sqrt-square14.3%
Simplified14.3%
if -0.050000000000000003 < (sin.f64 th) < 5.0000000000000001e-4Initial program 92.4%
remove-double-neg92.4%
sin-neg92.4%
neg-mul-192.4%
*-commutative92.4%
associate-*l*92.4%
associate-*l/90.9%
associate-/r/90.9%
associate-*l/92.4%
associate-/r/92.3%
sin-neg92.3%
neg-mul-192.3%
associate-/r*92.3%
associate-/r/92.4%
Simplified99.7%
expm1-log1p-u99.7%
expm1-udef23.2%
hypot-udef21.5%
unpow221.5%
unpow221.5%
+-commutative21.5%
unpow221.5%
unpow221.5%
hypot-def23.2%
Applied egg-rr23.2%
expm1-def99.7%
expm1-log1p99.7%
associate-*l/94.2%
*-commutative94.2%
associate-*l/99.7%
*-commutative99.7%
hypot-def92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 89.8%
associate-*l/89.9%
+-commutative89.9%
unpow289.9%
unpow289.9%
hypot-def97.2%
*-lft-identity97.2%
hypot-def89.9%
unpow289.9%
unpow289.9%
+-commutative89.9%
unpow289.9%
unpow289.9%
hypot-def97.2%
Simplified97.2%
if 0.34999999999999998 < (sin.f64 th) Initial program 86.6%
remove-double-neg86.6%
sin-neg86.6%
neg-mul-186.6%
*-commutative86.6%
associate-*l*86.6%
associate-*l/86.4%
associate-/r/86.4%
associate-*l/86.6%
associate-/r/86.6%
sin-neg86.6%
neg-mul-186.6%
associate-/r*86.6%
associate-/r/86.6%
Simplified99.7%
expm1-log1p-u99.6%
expm1-udef65.6%
hypot-udef56.5%
unpow256.5%
unpow256.5%
+-commutative56.5%
unpow256.5%
unpow256.5%
hypot-def65.6%
Applied egg-rr65.6%
expm1-def99.6%
expm1-log1p99.7%
associate-*l/99.3%
*-commutative99.3%
associate-*l/99.6%
*-commutative99.6%
hypot-def86.5%
unpow286.5%
unpow286.5%
+-commutative86.5%
unpow286.5%
unpow286.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 23.1%
add-sqr-sqrt22.1%
sqrt-unprod33.1%
pow233.1%
Applied egg-rr33.1%
unpow233.1%
rem-sqrt-square40.6%
Simplified40.6%
Final simplification63.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 4e-23)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 4e-23) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 4d-23) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 4e-23) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 4e-23: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 4e-23) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 4e-23) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-23], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef42.0%
hypot-udef42.0%
unpow242.0%
unpow242.0%
+-commutative42.0%
unpow242.0%
unpow242.0%
hypot-def42.0%
Applied egg-rr42.0%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod26.9%
pow226.9%
Applied egg-rr26.9%
unpow226.9%
rem-sqrt-square36.8%
Simplified36.8%
Taylor expanded in th around 0 26.7%
if -0.0200000000000000004 < (sin.f64 ky) < 3.99999999999999984e-23Initial program 83.5%
Taylor expanded in ky around 0 49.0%
add-sqr-sqrt20.5%
sqrt-unprod39.0%
pow239.0%
Applied egg-rr39.0%
unpow239.0%
rem-sqrt-square44.8%
Simplified44.8%
if 3.99999999999999984e-23 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.6%
Final simplification44.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 4e-23)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 4e-23) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 4d-23) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 4e-23) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 4e-23: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 4e-23) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 4e-23) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], 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], 4e-23], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef42.0%
hypot-udef42.0%
unpow242.0%
unpow242.0%
+-commutative42.0%
unpow242.0%
unpow242.0%
hypot-def42.0%
Applied egg-rr42.0%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod26.9%
pow226.9%
Applied egg-rr26.9%
unpow226.9%
rem-sqrt-square36.8%
Simplified36.8%
if -0.0200000000000000004 < (sin.f64 ky) < 3.99999999999999984e-23Initial program 83.5%
Taylor expanded in ky around 0 49.0%
add-sqr-sqrt20.5%
sqrt-unprod39.0%
pow239.0%
Applied egg-rr39.0%
unpow239.0%
rem-sqrt-square44.8%
Simplified44.8%
if 3.99999999999999984e-23 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.6%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0362) (* (sin ky) (fabs (/ th (sin ky)))) (if (<= (sin ky) 1e-69) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0362) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-69) {
tmp = sin(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.0362d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-69) then
tmp = sin(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.0362) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(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.0362: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-69: tmp = math.sin(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.0362) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(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.0362) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = sin(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.0362], 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[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0362:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.036200000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef41.8%
hypot-udef41.7%
unpow241.7%
unpow241.7%
+-commutative41.7%
unpow241.7%
unpow241.7%
hypot-def41.8%
Applied egg-rr41.8%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod27.6%
pow227.6%
Applied egg-rr27.6%
unpow227.6%
rem-sqrt-square37.9%
Simplified37.9%
Taylor expanded in th around 0 27.4%
if -0.036200000000000003 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.8%
remove-double-neg82.8%
sin-neg82.8%
neg-mul-182.8%
*-commutative82.8%
associate-*l*82.8%
associate-*l/81.0%
associate-/r/81.0%
associate-*l/82.8%
associate-/r/82.8%
sin-neg82.8%
neg-mul-182.8%
associate-/r*82.8%
associate-/r/82.8%
Simplified99.7%
expm1-log1p-u99.7%
expm1-udef35.5%
hypot-udef28.1%
unpow228.1%
unpow228.1%
+-commutative28.1%
unpow228.1%
unpow228.1%
hypot-def35.5%
Applied egg-rr35.5%
expm1-def99.7%
expm1-log1p99.7%
associate-*l/93.3%
*-commutative93.3%
associate-*l/99.6%
*-commutative99.6%
hypot-def82.7%
unpow282.7%
unpow282.7%
+-commutative82.7%
unpow282.7%
unpow282.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.3%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0362) (* (sin ky) (fabs (/ th (sin ky)))) (if (<= (sin ky) 1e-69) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0362) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0362d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0362) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0362: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0362) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0362) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0362], 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[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0362:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.036200000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef41.8%
hypot-udef41.7%
unpow241.7%
unpow241.7%
+-commutative41.7%
unpow241.7%
unpow241.7%
hypot-def41.8%
Applied egg-rr41.8%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod27.6%
pow227.6%
Applied egg-rr27.6%
unpow227.6%
rem-sqrt-square37.9%
Simplified37.9%
Taylor expanded in th around 0 27.4%
if -0.036200000000000003 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.8%
Taylor expanded in ky around 0 50.4%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0362) (* (sin ky) (fabs (/ th (sin ky)))) (if (<= (sin ky) 1e-69) (/ (sin ky) (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0362) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-69) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0362d0)) 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)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0362) {
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);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0362: 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) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0362) 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 = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0362) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0362], 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[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0362:\\
\;\;\;\;\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}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.036200000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef41.8%
hypot-udef41.7%
unpow241.7%
unpow241.7%
+-commutative41.7%
unpow241.7%
unpow241.7%
hypot-def41.8%
Applied egg-rr41.8%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod27.6%
pow227.6%
Applied egg-rr27.6%
unpow227.6%
rem-sqrt-square37.9%
Simplified37.9%
Taylor expanded in th around 0 27.4%
if -0.036200000000000003 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.8%
Taylor expanded in ky around 0 50.4%
associate-*l/47.6%
associate-/l*50.4%
Applied egg-rr50.4%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.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 91.6%
remove-double-neg91.6%
sin-neg91.6%
neg-mul-191.6%
*-commutative91.6%
associate-*l*91.6%
associate-*l/90.7%
associate-/r/90.7%
associate-*l/91.6%
associate-/r/91.6%
sin-neg91.6%
neg-mul-191.6%
associate-/r*91.6%
associate-/r/91.6%
Simplified99.7%
expm1-log1p-u99.6%
expm1-udef43.5%
hypot-udef40.0%
unpow240.0%
unpow240.0%
+-commutative40.0%
unpow240.0%
unpow240.0%
hypot-def43.5%
Applied egg-rr43.5%
expm1-def99.6%
expm1-log1p99.7%
associate-*l/96.6%
*-commutative96.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.116)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(/ (sin th) (/ (hypot (sin ky) kx) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.116) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else {
tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.116) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.116: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) else: tmp = math.sin(th) / (math.hypot(math.sin(ky), kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.116) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); else tmp = Float64(sin(th) / Float64(hypot(sin(ky), kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.116) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); else tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.116], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.116:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\end{array}
\end{array}
if th < 0.116000000000000006Initial program 90.3%
remove-double-neg90.3%
sin-neg90.3%
neg-mul-190.3%
*-commutative90.3%
associate-*l*90.3%
associate-*l/89.2%
associate-/r/89.2%
associate-*l/90.3%
associate-/r/90.3%
sin-neg90.3%
neg-mul-190.3%
associate-/r*90.3%
associate-/r/90.3%
Simplified99.7%
expm1-log1p-u99.7%
expm1-udef37.0%
hypot-udef33.3%
unpow233.3%
unpow233.3%
+-commutative33.3%
unpow233.3%
unpow233.3%
hypot-def37.0%
Applied egg-rr37.0%
expm1-def99.7%
expm1-log1p99.7%
associate-*l/95.8%
*-commutative95.8%
associate-*l/99.7%
*-commutative99.7%
hypot-def90.3%
unpow290.3%
unpow290.3%
+-commutative90.3%
unpow290.3%
unpow290.3%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 63.0%
+-commutative63.0%
+-commutative63.0%
unpow263.0%
unpow263.0%
hypot-def68.0%
associate-*r*68.0%
+-commutative68.0%
unpow268.0%
unpow268.0%
hypot-def68.1%
distribute-rgt-out68.1%
Simplified68.1%
if 0.116000000000000006 < th Initial program 96.1%
Taylor expanded in kx around 0 50.2%
expm1-log1p-u50.0%
expm1-udef39.4%
*-commutative39.4%
clear-num39.4%
un-div-inv39.4%
+-commutative39.4%
unpow239.4%
unpow239.4%
hypot-def42.5%
Applied egg-rr42.5%
expm1-def53.7%
expm1-log1p53.8%
Simplified53.8%
Final simplification64.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-69) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-69) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-69) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-69) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-69: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-69) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-69) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef42.0%
hypot-udef42.0%
unpow242.0%
unpow242.0%
+-commutative42.0%
unpow242.0%
unpow242.0%
hypot-def42.0%
Applied egg-rr42.0%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod18.2%
pow218.2%
Applied egg-rr18.2%
unpow218.2%
rem-sqrt-square23.8%
associate-*r/23.8%
associate-/l*23.7%
associate-/r/23.8%
*-inverses23.8%
*-lft-identity23.8%
Simplified23.8%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.5%
Taylor expanded in ky around 0 50.9%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 1e-69) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-69) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-69) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-69) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-69: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-69) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-69) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef42.0%
hypot-udef42.0%
unpow242.0%
unpow242.0%
+-commutative42.0%
unpow242.0%
unpow242.0%
hypot-def42.0%
Applied egg-rr42.0%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod18.2%
pow218.2%
Applied egg-rr18.2%
unpow218.2%
rem-sqrt-square23.8%
associate-*r/23.8%
associate-/l*23.7%
associate-/r/23.8%
*-inverses23.8%
*-lft-identity23.8%
Simplified23.8%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.5%
remove-double-neg82.5%
sin-neg82.5%
neg-mul-182.5%
*-commutative82.5%
associate-*l*82.5%
associate-*l/80.6%
associate-/r/80.6%
associate-*l/82.5%
associate-/r/82.5%
sin-neg82.5%
neg-mul-182.5%
associate-/r*82.5%
associate-/r/82.5%
Simplified99.7%
Taylor expanded in ky around 0 48.1%
associate-/l*50.9%
Simplified50.9%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (* (sin ky) (fabs (/ th (sin ky)))) (if (<= (sin ky) 1e-69) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-69) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-69) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-69) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-69: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-69) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], 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[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef42.0%
hypot-udef42.0%
unpow242.0%
unpow242.0%
+-commutative42.0%
unpow242.0%
unpow242.0%
hypot-def42.0%
Applied egg-rr42.0%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.1%
sqrt-unprod26.9%
pow226.9%
Applied egg-rr26.9%
unpow226.9%
rem-sqrt-square36.8%
Simplified36.8%
Taylor expanded in th around 0 26.7%
if -0.0200000000000000004 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 82.5%
remove-double-neg82.5%
sin-neg82.5%
neg-mul-182.5%
*-commutative82.5%
associate-*l*82.5%
associate-*l/80.6%
associate-/r/80.6%
associate-*l/82.5%
associate-/r/82.5%
sin-neg82.5%
neg-mul-182.5%
associate-/r*82.5%
associate-/r/82.5%
Simplified99.7%
Taylor expanded in ky around 0 48.1%
associate-/l*50.9%
Simplified50.9%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.2%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0135) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (/ (sin th) (/ (hypot (sin ky) kx) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0135) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0135) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0135: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = math.sin(th) / (math.hypot(math.sin(ky), kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0135) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(sin(th) / Float64(hypot(sin(ky), kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0135) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0135], 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[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0135:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\end{array}
\end{array}
if th < 0.0134999999999999998Initial program 90.3%
remove-double-neg90.3%
sin-neg90.3%
neg-mul-190.3%
*-commutative90.3%
associate-*l*90.3%
associate-*l/89.2%
associate-/r/89.2%
associate-*l/90.3%
associate-/r/90.3%
sin-neg90.3%
neg-mul-190.3%
associate-/r*90.3%
associate-/r/90.3%
Simplified99.7%
expm1-log1p-u99.7%
expm1-udef37.0%
hypot-udef33.3%
unpow233.3%
unpow233.3%
+-commutative33.3%
unpow233.3%
unpow233.3%
hypot-def37.0%
Applied egg-rr37.0%
expm1-def99.7%
expm1-log1p99.7%
associate-*l/95.8%
*-commutative95.8%
associate-*l/99.7%
*-commutative99.7%
hypot-def90.3%
unpow290.3%
unpow290.3%
+-commutative90.3%
unpow290.3%
unpow290.3%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 62.0%
associate-*l/62.2%
+-commutative62.2%
unpow262.2%
unpow262.2%
hypot-def67.2%
*-lft-identity67.2%
hypot-def62.2%
unpow262.2%
unpow262.2%
+-commutative62.2%
unpow262.2%
unpow262.2%
hypot-def67.2%
Simplified67.2%
if 0.0134999999999999998 < th Initial program 96.1%
Taylor expanded in kx around 0 50.2%
expm1-log1p-u50.0%
expm1-udef39.4%
*-commutative39.4%
clear-num39.4%
un-div-inv39.4%
+-commutative39.4%
unpow239.4%
unpow239.4%
hypot-def42.5%
Applied egg-rr42.5%
expm1-def53.7%
expm1-log1p53.8%
Simplified53.8%
Final simplification64.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.03) (fabs (sin th)) (if (<= (sin ky) 1e-85) (/ ky (/ kx (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.03) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-85) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.03d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-85) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.03) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-85) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.03: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-85: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.03) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-85) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.03) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-85) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.03], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-85], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.03:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-85}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.029999999999999999Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-udef41.8%
hypot-udef41.7%
unpow241.7%
unpow241.7%
+-commutative41.7%
unpow241.7%
unpow241.7%
hypot-def41.8%
Applied egg-rr41.8%
expm1-def99.6%
expm1-log1p99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.6%
sqrt-unprod18.5%
pow218.5%
Applied egg-rr18.5%
unpow218.5%
rem-sqrt-square24.3%
associate-*r/24.3%
associate-/l*24.3%
associate-/r/24.3%
*-inverses24.3%
*-lft-identity24.3%
Simplified24.3%
if -0.029999999999999999 < (sin.f64 ky) < 9.9999999999999998e-86Initial program 82.5%
Taylor expanded in kx around 0 44.0%
Taylor expanded in ky around 0 29.4%
associate-/l*32.1%
Simplified32.1%
if 9.9999999999999998e-86 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.6%
Final simplification38.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.2e-85) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.2e-85) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.2d-85) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.2e-85) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.2e-85: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.2e-85) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.2e-85) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.2e-85], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.2 \cdot 10^{-85}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.2e-85Initial program 87.9%
Taylor expanded in kx around 0 46.4%
Taylor expanded in ky around 0 22.9%
if 2.2e-85 < ky Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.2%
Final simplification26.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-85) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-85) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8d-85) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-85) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8e-85: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8e-85) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8e-85) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-85], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8 \cdot 10^{-85}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.9999999999999998e-85Initial program 87.9%
Taylor expanded in kx around 0 46.4%
Taylor expanded in ky around 0 21.1%
associate-/l*22.9%
Simplified22.9%
if 7.9999999999999998e-85 < ky Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.2%
Final simplification26.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.7e-161) (* th (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.7e-161) {
tmp = th * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.7d-161) then
tmp = th * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.7e-161) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.7e-161: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.7e-161) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.7e-161) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.7e-161], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.7 \cdot 10^{-161}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.69999999999999991e-161Initial program 87.2%
Taylor expanded in kx around 0 47.0%
Taylor expanded in ky around 0 24.0%
Taylor expanded in th around 0 18.0%
associate-/l*19.9%
Simplified19.9%
associate-/r/19.9%
Applied egg-rr19.9%
if 1.69999999999999991e-161 < ky Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.5%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.5%
Simplified99.7%
Taylor expanded in kx around 0 30.6%
Final simplification23.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.2e-83) (* th (/ ky kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-83) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4.2d-83) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-83) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.2e-83: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.2e-83) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.2e-83) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.2e-83], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.2 \cdot 10^{-83}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 4.1999999999999998e-83Initial program 87.9%
Taylor expanded in kx around 0 46.4%
Taylor expanded in ky around 0 22.9%
Taylor expanded in th around 0 17.3%
associate-/l*19.0%
Simplified19.0%
associate-/r/19.1%
Applied egg-rr19.1%
if 4.1999999999999998e-83 < ky Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
expm1-log1p-u99.7%
expm1-udef52.6%
hypot-udef52.5%
unpow252.5%
unpow252.5%
+-commutative52.5%
unpow252.5%
unpow252.5%
hypot-def52.6%
Applied egg-rr52.6%
expm1-def99.7%
expm1-log1p99.7%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def99.7%
unpow299.7%
unpow299.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.2%
Taylor expanded in th around 0 13.3%
Final simplification17.3%
(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 91.6%
remove-double-neg91.6%
sin-neg91.6%
neg-mul-191.6%
*-commutative91.6%
associate-*l*91.6%
associate-*l/90.7%
associate-/r/90.7%
associate-*l/91.6%
associate-/r/91.6%
sin-neg91.6%
neg-mul-191.6%
associate-/r*91.6%
associate-/r/91.6%
Simplified99.7%
expm1-log1p-u99.6%
expm1-udef43.5%
hypot-udef40.0%
unpow240.0%
unpow240.0%
+-commutative40.0%
unpow240.0%
unpow240.0%
hypot-def43.5%
Applied egg-rr43.5%
expm1-def99.6%
expm1-log1p99.7%
associate-*l/96.6%
*-commutative96.6%
associate-*l/99.7%
*-commutative99.7%
hypot-def91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 22.9%
Taylor expanded in th around 0 11.2%
Final simplification11.2%
herbie shell --seed 2023318
(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)))