
(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 16 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 kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Initial program 94.6%
*-commutative94.6%
clear-num94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-udef99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin ky) -0.25)
t_1
(if (<= (sin ky) -0.05)
(/ (sin ky) (fabs (/ (sin ky) (sin th))))
(if (<= (sin ky) -2e-8)
t_1
(if (<= (sin ky) 2e-124) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(ky) <= -0.25) {
tmp = t_1;
} else if (sin(ky) <= -0.05) {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
} else if (sin(ky) <= -2e-8) {
tmp = t_1;
} else if (sin(ky) <= 2e-124) {
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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (sin(ky) <= (-0.25d0)) then
tmp = t_1
else if (sin(ky) <= (-0.05d0)) then
tmp = sin(ky) / abs((sin(ky) / sin(th)))
else if (sin(ky) <= (-2d-8)) then
tmp = t_1
else if (sin(ky) <= 2d-124) 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 t_1 = Math.abs(Math.sin(th));
double tmp;
if (Math.sin(ky) <= -0.25) {
tmp = t_1;
} else if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
} else if (Math.sin(ky) <= -2e-8) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-124) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(ky) <= -0.25: tmp = t_1 elif math.sin(ky) <= -0.05: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) elif math.sin(ky) <= -2e-8: tmp = t_1 elif math.sin(ky) <= 2e-124: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(ky) <= -0.25) tmp = t_1; elseif (sin(ky) <= -0.05) tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); elseif (sin(ky) <= -2e-8) tmp = t_1; elseif (sin(ky) <= 2e-124) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(ky) <= -0.25) tmp = t_1; elseif (sin(ky) <= -0.05) tmp = sin(ky) / abs((sin(ky) / sin(th))); elseif (sin(ky) <= -2e-8) tmp = t_1; elseif (sin(ky) <= 2e-124) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.25], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-8], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-124], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin ky \leq -0.25:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-124}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.25 or -0.050000000000000003 < (sin.f64 ky) < -2e-8Initial program 99.5%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
+-commutative99.5%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
associate-/r/2.6%
*-inverses2.6%
*-un-lft-identity2.6%
add-sqr-sqrt1.2%
sqrt-unprod21.4%
pow221.4%
Applied egg-rr21.4%
unpow221.4%
rem-sqrt-square34.8%
Simplified34.8%
if -0.25 < (sin.f64 ky) < -0.050000000000000003Initial program 99.8%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in kx around 0 3.3%
add-sqr-sqrt0.7%
sqrt-unprod59.8%
pow259.8%
Applied egg-rr59.8%
unpow259.8%
rem-sqrt-square74.2%
Simplified74.2%
if -2e-8 < (sin.f64 ky) < 1.99999999999999987e-124Initial program 87.1%
+-commutative87.1%
unpow287.1%
unpow287.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.8%
if 1.99999999999999987e-124 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 58.9%
Final simplification53.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= (sin th) -5e-7) (not (<= (sin th) 1e-17)))
(/ (* (sin th) ky) t_1)
(/ (sin ky) (/ t_1 th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((sin(th) <= -5e-7) || !(sin(th) <= 1e-17)) {
tmp = (sin(th) * ky) / t_1;
} else {
tmp = sin(ky) / (t_1 / th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if ((Math.sin(th) <= -5e-7) || !(Math.sin(th) <= 1e-17)) {
tmp = (Math.sin(th) * ky) / t_1;
} else {
tmp = Math.sin(ky) / (t_1 / th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (math.sin(th) <= -5e-7) or not (math.sin(th) <= 1e-17): tmp = (math.sin(th) * ky) / t_1 else: tmp = math.sin(ky) / (t_1 / th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((sin(th) <= -5e-7) || !(sin(th) <= 1e-17)) tmp = Float64(Float64(sin(th) * ky) / t_1); else tmp = Float64(sin(ky) / Float64(t_1 / th)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((sin(th) <= -5e-7) || ~((sin(th) <= 1e-17))) tmp = (sin(th) * ky) / t_1; else tmp = sin(ky) / (t_1 / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[Or[LessEqual[N[Sin[th], $MachinePrecision], -5e-7], N[Not[LessEqual[N[Sin[th], $MachinePrecision], 1e-17]], $MachinePrecision]], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(t$95$1 / th), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin th \leq -5 \cdot 10^{-7} \lor \neg \left(\sin th \leq 10^{-17}\right):\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{t_1}{th}}\\
\end{array}
\end{array}
if (sin.f64 th) < -4.99999999999999977e-7 or 1.00000000000000007e-17 < (sin.f64 th) Initial program 92.2%
associate-*l/92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 54.8%
if -4.99999999999999977e-7 < (sin.f64 th) < 1.00000000000000007e-17Initial program 97.2%
associate-/r/97.1%
+-commutative97.1%
unpow297.1%
sqr-neg97.1%
sin-neg97.1%
sin-neg97.1%
unpow297.1%
+-commutative97.1%
Simplified99.8%
Taylor expanded in th around 0 99.7%
Final simplification76.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (sin th))
(if (<= (sin th) 2e-8)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(/ (sin ky) (fabs (/ (sin ky) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(th) <= 2e-8) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 2e-8) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 2e-8: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 2e-8) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 2e-8) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); else tmp = sin(ky) / abs((sin(ky) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-8], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-8}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 92.8%
associate-/r/92.8%
+-commutative92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
+-commutative92.8%
Simplified99.5%
Taylor expanded in kx around 0 24.3%
associate-/r/24.4%
*-inverses24.4%
*-un-lft-identity24.4%
add-sqr-sqrt0.0%
sqrt-unprod26.5%
pow226.5%
Applied egg-rr26.5%
unpow226.5%
rem-sqrt-square26.5%
Simplified26.5%
if -0.050000000000000003 < (sin.f64 th) < 2e-8Initial program 97.2%
+-commutative97.2%
unpow297.2%
unpow297.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 98.9%
if 2e-8 < (sin.f64 th) Initial program 91.4%
associate-/r/91.2%
+-commutative91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
+-commutative91.2%
Simplified99.3%
Taylor expanded in kx around 0 21.2%
add-sqr-sqrt20.4%
sqrt-unprod39.9%
pow239.9%
Applied egg-rr39.9%
unpow239.9%
rem-sqrt-square44.3%
Simplified44.3%
Final simplification68.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (sin th))
(if (<= (sin th) 2e-8)
(/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))
(/ (sin ky) (fabs (/ (sin ky) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(th) <= 2e-8) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 2e-8) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 2e-8: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) else: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 2e-8) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); else tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 2e-8) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); else tmp = sin(ky) / abs((sin(ky) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-8], N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 92.8%
associate-/r/92.8%
+-commutative92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
+-commutative92.8%
Simplified99.5%
Taylor expanded in kx around 0 24.3%
associate-/r/24.4%
*-inverses24.4%
*-un-lft-identity24.4%
add-sqr-sqrt0.0%
sqrt-unprod26.5%
pow226.5%
Applied egg-rr26.5%
unpow226.5%
rem-sqrt-square26.5%
Simplified26.5%
if -0.050000000000000003 < (sin.f64 th) < 2e-8Initial program 97.2%
*-commutative97.2%
clear-num97.1%
+-commutative97.1%
unpow297.1%
unpow297.1%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 98.9%
if 2e-8 < (sin.f64 th) Initial program 91.4%
associate-/r/91.2%
+-commutative91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
+-commutative91.2%
Simplified99.3%
Taylor expanded in kx around 0 21.2%
add-sqr-sqrt20.4%
sqrt-unprod39.9%
pow239.9%
Applied egg-rr39.9%
unpow239.9%
rem-sqrt-square44.3%
Simplified44.3%
Final simplification68.4%
(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.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= th -0.07) (not (<= th 0.08)))
(/ (* (sin th) ky) t_1)
(/ (sin ky) (* t_1 (+ (* th 0.16666666666666666) (/ 1.0 th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((th <= -0.07) || !(th <= 0.08)) {
tmp = (sin(th) * ky) / t_1;
} else {
tmp = sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if ((th <= -0.07) || !(th <= 0.08)) {
tmp = (Math.sin(th) * ky) / t_1;
} else {
tmp = Math.sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th)));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (th <= -0.07) or not (th <= 0.08): tmp = (math.sin(th) * ky) / t_1 else: tmp = math.sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th))) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((th <= -0.07) || !(th <= 0.08)) tmp = Float64(Float64(sin(th) * ky) / t_1); else tmp = Float64(sin(ky) / Float64(t_1 * Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th)))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((th <= -0.07) || ~((th <= 0.08))) tmp = (sin(th) * ky) / t_1; else tmp = sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[Or[LessEqual[th, -0.07], N[Not[LessEqual[th, 0.08]], $MachinePrecision]], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(t$95$1 * N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq -0.07 \lor \neg \left(th \leq 0.08\right):\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{t_1 \cdot \left(th \cdot 0.16666666666666666 + \frac{1}{th}\right)}\\
\end{array}
\end{array}
if th < -0.070000000000000007 or 0.0800000000000000017 < th Initial program 91.9%
associate-*l/91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 53.5%
if -0.070000000000000007 < th < 0.0800000000000000017Initial program 97.3%
associate-/r/97.2%
+-commutative97.2%
unpow297.2%
sqr-neg97.2%
sin-neg97.2%
sin-neg97.2%
unpow297.2%
+-commutative97.2%
Simplified99.7%
Taylor expanded in th around 0 96.7%
+-commutative96.7%
*-commutative96.7%
unpow296.7%
unpow296.7%
hypot-def99.2%
associate-*r/99.4%
*-commutative99.4%
associate-*l/99.2%
associate-*r*99.2%
Simplified99.2%
Final simplification76.9%
(FPCore (kx ky th)
:precision binary64
(if (or (<= th -0.22) (not (<= th 0.23)))
(/ (* (sin th) ky) (hypot (sin ky) (sin kx)))
(/
(/ (sin ky) (hypot (sin kx) (sin ky)))
(+ (* th 0.16666666666666666) (/ 1.0 th)))))
double code(double kx, double ky, double th) {
double tmp;
if ((th <= -0.22) || !(th <= 0.23)) {
tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx));
} else {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((th <= -0.22) || !(th <= 0.23)) {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (th <= -0.22) or not (th <= 0.23): tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((th <= -0.22) || !(th <= 0.23)) tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), sin(kx))); else tmp = Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((th <= -0.22) || ~((th <= 0.23))) tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx)); else tmp = (sin(ky) / hypot(sin(kx), sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[th, -0.22], N[Not[LessEqual[th, 0.23]], $MachinePrecision]], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -0.22 \lor \neg \left(th \leq 0.23\right):\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}}{th \cdot 0.16666666666666666 + \frac{1}{th}}\\
\end{array}
\end{array}
if th < -0.220000000000000001 or 0.23000000000000001 < th Initial program 91.9%
associate-*l/91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 53.5%
if -0.220000000000000001 < th < 0.23000000000000001Initial program 97.3%
associate-*l/94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-udef95.7%
associate-/l*99.7%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 99.3%
Final simplification76.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-8) (fabs (sin th)) (if (<= (sin ky) 2e-124) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-8) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-124) {
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) <= (-2d-8)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-124) 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) <= -2e-8) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-124) {
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) <= -2e-8: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-124: 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) <= -2e-8) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-124) 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) <= -2e-8) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-124) 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], -2e-8], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-124], 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 -2 \cdot 10^{-8}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-124}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-8Initial program 99.5%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
+-commutative99.5%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
associate-/r/2.7%
*-inverses2.7%
*-un-lft-identity2.7%
add-sqr-sqrt1.3%
sqrt-unprod19.7%
pow219.7%
Applied egg-rr19.7%
unpow219.7%
rem-sqrt-square33.0%
Simplified33.0%
if -2e-8 < (sin.f64 ky) < 1.99999999999999987e-124Initial program 87.1%
+-commutative87.1%
unpow287.1%
unpow287.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.8%
if 1.99999999999999987e-124 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 58.9%
Final simplification51.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -2e-21)
t_1
(if (<= ky 1.12e-142)
(/ ky (* (sin kx) (+ (* th 0.16666666666666666) (/ 1.0 th))))
(if (<= ky 2.5e+139) (sin th) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -2e-21) {
tmp = t_1;
} else if (ky <= 1.12e-142) {
tmp = ky / (sin(kx) * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (ky <= 2.5e+139) {
tmp = sin(th);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (ky <= (-2d-21)) then
tmp = t_1
else if (ky <= 1.12d-142) then
tmp = ky / (sin(kx) * ((th * 0.16666666666666666d0) + (1.0d0 / th)))
else if (ky <= 2.5d+139) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (ky <= -2e-21) {
tmp = t_1;
} else if (ky <= 1.12e-142) {
tmp = ky / (Math.sin(kx) * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (ky <= 2.5e+139) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -2e-21: tmp = t_1 elif ky <= 1.12e-142: tmp = ky / (math.sin(kx) * ((th * 0.16666666666666666) + (1.0 / th))) elif ky <= 2.5e+139: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -2e-21) tmp = t_1; elseif (ky <= 1.12e-142) tmp = Float64(ky / Float64(sin(kx) * Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th)))); elseif (ky <= 2.5e+139) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -2e-21) tmp = t_1; elseif (ky <= 1.12e-142) tmp = ky / (sin(kx) * ((th * 0.16666666666666666) + (1.0 / th))); elseif (ky <= 2.5e+139) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -2e-21], t$95$1, If[LessEqual[ky, 1.12e-142], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.5e+139], N[Sin[th], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -2 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-142}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \left(th \cdot 0.16666666666666666 + \frac{1}{th}\right)}\\
\mathbf{elif}\;ky \leq 2.5 \cdot 10^{+139}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if ky < -1.99999999999999982e-21 or 2.50000000000000015e139 < ky Initial program 99.6%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
+-commutative99.5%
Simplified99.6%
Taylor expanded in kx around 0 27.3%
associate-/r/27.4%
*-inverses27.4%
*-un-lft-identity27.4%
add-sqr-sqrt14.0%
sqrt-unprod25.2%
pow225.2%
Applied egg-rr25.2%
unpow225.2%
rem-sqrt-square36.3%
Simplified36.3%
if -1.99999999999999982e-21 < ky < 1.1199999999999999e-142Initial program 86.3%
associate-/r/86.3%
+-commutative86.3%
unpow286.3%
sqr-neg86.3%
sin-neg86.3%
sin-neg86.3%
unpow286.3%
+-commutative86.3%
Simplified99.6%
Taylor expanded in th around 0 49.4%
+-commutative49.4%
*-commutative49.4%
unpow249.4%
unpow249.4%
hypot-def52.9%
associate-*r/53.0%
*-commutative53.0%
associate-*l/52.9%
associate-*r*52.9%
Simplified53.1%
Taylor expanded in ky around 0 34.9%
if 1.1199999999999999e-142 < ky < 2.50000000000000015e139Initial program 99.6%
Taylor expanded in kx around 0 40.1%
Final simplification36.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -960000000.0)
(sin th)
(if (<= ky 1e-142)
(/ ky (* (sin kx) (+ (* th 0.16666666666666666) (/ 1.0 th))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -960000000.0) {
tmp = sin(th);
} else if (ky <= 1e-142) {
tmp = ky / (sin(kx) * ((th * 0.16666666666666666) + (1.0 / 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 <= (-960000000.0d0)) then
tmp = sin(th)
else if (ky <= 1d-142) then
tmp = ky / (sin(kx) * ((th * 0.16666666666666666d0) + (1.0d0 / 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 <= -960000000.0) {
tmp = Math.sin(th);
} else if (ky <= 1e-142) {
tmp = ky / (Math.sin(kx) * ((th * 0.16666666666666666) + (1.0 / th)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -960000000.0: tmp = math.sin(th) elif ky <= 1e-142: tmp = ky / (math.sin(kx) * ((th * 0.16666666666666666) + (1.0 / th))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -960000000.0) tmp = sin(th); elseif (ky <= 1e-142) tmp = Float64(ky / Float64(sin(kx) * Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -960000000.0) tmp = sin(th); elseif (ky <= 1e-142) tmp = ky / (sin(kx) * ((th * 0.16666666666666666) + (1.0 / th))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -960000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1e-142], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -960000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 10^{-142}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \left(th \cdot 0.16666666666666666 + \frac{1}{th}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -9.6e8 or 1e-142 < ky Initial program 99.6%
Taylor expanded in kx around 0 33.3%
if -9.6e8 < ky < 1e-142Initial program 86.9%
associate-/r/87.0%
+-commutative87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
+-commutative87.0%
Simplified99.6%
Taylor expanded in th around 0 49.2%
+-commutative49.2%
*-commutative49.2%
unpow249.2%
unpow249.2%
hypot-def52.5%
associate-*r/52.6%
*-commutative52.6%
associate-*l/52.5%
associate-*r*52.5%
Simplified52.6%
Taylor expanded in ky around 0 33.3%
Final simplification33.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5400000.0) (sin th) (if (<= ky 7.6e-244) (log (+ 1.0 (+ th (* 0.5 (* th th))))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5400000.0) {
tmp = sin(th);
} else if (ky <= 7.6e-244) {
tmp = log((1.0 + (th + (0.5 * (th * 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 <= (-5400000.0d0)) then
tmp = sin(th)
else if (ky <= 7.6d-244) then
tmp = log((1.0d0 + (th + (0.5d0 * (th * 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 <= -5400000.0) {
tmp = Math.sin(th);
} else if (ky <= 7.6e-244) {
tmp = Math.log((1.0 + (th + (0.5 * (th * th)))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5400000.0: tmp = math.sin(th) elif ky <= 7.6e-244: tmp = math.log((1.0 + (th + (0.5 * (th * th))))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5400000.0) tmp = sin(th); elseif (ky <= 7.6e-244) tmp = log(Float64(1.0 + Float64(th + Float64(0.5 * Float64(th * th))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5400000.0) tmp = sin(th); elseif (ky <= 7.6e-244) tmp = log((1.0 + (th + (0.5 * (th * th))))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5400000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 7.6e-244], N[Log[N[(1.0 + N[(th + N[(0.5 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5400000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 7.6 \cdot 10^{-244}:\\
\;\;\;\;\log \left(1 + \left(th + 0.5 \cdot \left(th \cdot th\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.4e6 or 7.6000000000000001e-244 < ky Initial program 97.3%
Taylor expanded in kx around 0 32.7%
if -5.4e6 < ky < 7.6000000000000001e-244Initial program 89.0%
associate-/r/89.0%
+-commutative89.0%
unpow289.0%
sqr-neg89.0%
sin-neg89.0%
sin-neg89.0%
unpow289.0%
+-commutative89.0%
Simplified99.6%
Taylor expanded in kx around 0 3.7%
associate-/r/3.7%
*-inverses3.7%
*-un-lft-identity3.7%
add-log-exp22.5%
Applied egg-rr22.5%
Taylor expanded in th around 0 23.2%
unpow223.2%
Simplified23.2%
Final simplification29.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5400000.0) (sin th) (if (<= ky 3.1e-264) (log (+ th 1.0)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5400000.0) {
tmp = sin(th);
} else if (ky <= 3.1e-264) {
tmp = log((th + 1.0));
} 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 <= (-5400000.0d0)) then
tmp = sin(th)
else if (ky <= 3.1d-264) then
tmp = log((th + 1.0d0))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5400000.0) {
tmp = Math.sin(th);
} else if (ky <= 3.1e-264) {
tmp = Math.log((th + 1.0));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5400000.0: tmp = math.sin(th) elif ky <= 3.1e-264: tmp = math.log((th + 1.0)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5400000.0) tmp = sin(th); elseif (ky <= 3.1e-264) tmp = log(Float64(th + 1.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5400000.0) tmp = sin(th); elseif (ky <= 3.1e-264) tmp = log((th + 1.0)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5400000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.1e-264], N[Log[N[(th + 1.0), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5400000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.1 \cdot 10^{-264}:\\
\;\;\;\;\log \left(th + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.4e6 or 3.1000000000000002e-264 < ky Initial program 96.9%
Taylor expanded in kx around 0 31.9%
if -5.4e6 < ky < 3.1000000000000002e-264Initial program 89.6%
associate-/r/89.6%
+-commutative89.6%
unpow289.6%
sqr-neg89.6%
sin-neg89.6%
sin-neg89.6%
unpow289.6%
+-commutative89.6%
Simplified99.6%
Taylor expanded in kx around 0 3.6%
associate-/r/3.6%
*-inverses3.6%
*-un-lft-identity3.6%
add-log-exp23.5%
Applied egg-rr23.5%
Taylor expanded in th around 0 24.0%
+-commutative24.0%
Simplified24.0%
Final simplification29.5%
(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.6%
Taylor expanded in kx around 0 23.3%
Final simplification23.3%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (* th 0.16666666666666666) (/ 1.0 th))))
double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((th * 0.16666666666666666d0) + (1.0d0 / th))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
def code(kx, ky, th): return 1.0 / ((th * 0.16666666666666666) + (1.0 / th))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((th * 0.16666666666666666) + (1.0 / th)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{th \cdot 0.16666666666666666 + \frac{1}{th}}
\end{array}
Initial program 94.6%
associate-/r/94.6%
+-commutative94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
+-commutative94.6%
Simplified99.6%
Taylor expanded in th around 0 51.7%
+-commutative51.7%
*-commutative51.7%
unpow251.7%
unpow251.7%
hypot-def53.0%
associate-*r/53.1%
*-commutative53.1%
associate-*l/53.0%
associate-*r*53.0%
Simplified53.0%
Taylor expanded in kx around 0 14.5%
Final simplification14.5%
(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.6%
associate-/r/94.6%
+-commutative94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
+-commutative94.6%
Simplified99.6%
Taylor expanded in kx around 0 23.2%
Taylor expanded in th around 0 13.7%
Final simplification13.7%
herbie shell --seed 2023272
(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)))