
(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 13 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 93.5%
remove-double-neg93.5%
sin-neg93.5%
neg-mul-193.5%
*-commutative93.5%
associate-*l*93.5%
associate-*l/92.7%
associate-/r/92.7%
associate-*l/93.5%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.5%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ ky (sin kx)))))
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 5e-173)
t_1
(if (<= (sin ky) 8e-85)
(/ (* (sin ky) (sin th)) ky)
(if (<= (sin ky) 4e-41) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (ky / sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-173) {
tmp = t_1;
} else if (sin(ky) <= 8e-85) {
tmp = (sin(ky) * sin(th)) / ky;
} else if (sin(ky) <= 4e-41) {
tmp = t_1;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(th) * (ky / sin(kx))
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-173) then
tmp = t_1
else if (sin(ky) <= 8d-85) then
tmp = (sin(ky) * sin(th)) / ky
else if (sin(ky) <= 4d-41) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (ky / Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-173) {
tmp = t_1;
} else if (Math.sin(ky) <= 8e-85) {
tmp = (Math.sin(ky) * Math.sin(th)) / ky;
} else if (Math.sin(ky) <= 4e-41) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (ky / math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-173: tmp = t_1 elif math.sin(ky) <= 8e-85: tmp = (math.sin(ky) * math.sin(th)) / ky elif math.sin(ky) <= 4e-41: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(ky / sin(kx))) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-173) tmp = t_1; elseif (sin(ky) <= 8e-85) tmp = Float64(Float64(sin(ky) * sin(th)) / ky); elseif (sin(ky) <= 4e-41) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (ky / sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-173) tmp = t_1; elseif (sin(ky) <= 8e-85) tmp = (sin(ky) * sin(th)) / ky; elseif (sin(ky) <= 4e-41) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-173], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 8e-85], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-41], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 8 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{ky}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\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.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt2.0%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000002e-173 or 7.9999999999999998e-85 < (sin.f64 ky) < 4.00000000000000002e-41Initial program 84.6%
Taylor expanded in ky around 0 51.1%
if 5.0000000000000002e-173 < (sin.f64 ky) < 7.9999999999999998e-85Initial program 94.2%
remove-double-neg94.2%
sin-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-*l*94.2%
associate-*l/94.4%
associate-/r/94.4%
associate-*l/94.2%
associate-/r/94.6%
sin-neg94.6%
neg-mul-194.6%
associate-/r*94.6%
associate-/r/94.2%
Simplified99.3%
Taylor expanded in ky around 0 99.3%
Taylor expanded in ky around inf 39.3%
if 4.00000000000000002e-41 < (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.5%
associate-/r/99.5%
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 54.6%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 1e-139)
(* (sin th) (/ ky (sin kx)))
(if (<= (sin ky) 2e-28) (* th (/ ky (hypot 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-139) {
tmp = sin(th) * (ky / sin(kx));
} else if (sin(ky) <= 2e-28) {
tmp = th * (ky / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
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-139) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-28) {
tmp = th * (ky / Math.hypot(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-139: tmp = math.sin(th) * (ky / math.sin(kx)) elif math.sin(ky) <= 2e-28: tmp = th * (ky / math.hypot(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-139) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (sin(ky) <= 2e-28) tmp = Float64(th * Float64(ky / hypot(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-139) tmp = sin(th) * (ky / sin(kx)); elseif (sin(ky) <= 2e-28) tmp = th * (ky / hypot(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-139], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-28], N[(th * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $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^{-139}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-28}:\\
\;\;\;\;th \cdot \frac{ky}{\mathsf{hypot}\left(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.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt2.0%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 1.00000000000000003e-139Initial program 83.1%
Taylor expanded in ky around 0 49.2%
if 1.00000000000000003e-139 < (sin.f64 ky) < 1.99999999999999994e-28Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.5%
associate-/r/99.8%
sin-neg99.8%
neg-mul-199.8%
associate-/r*99.8%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 99.5%
Taylor expanded in th around 0 50.0%
Taylor expanded in ky around 0 50.0%
if 1.99999999999999994e-28 < (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.5%
associate-/r/99.5%
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 55.3%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.1)
(fabs (sin th))
(if (<= (sin ky) 1e-139)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 2e-28) (* th (/ ky (hypot ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.1) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-139) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 2e-28) {
tmp = th * (ky / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.1) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-139) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-28) {
tmp = th * (ky / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.1: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-139: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 2e-28: tmp = th * (ky / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.1) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-139) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 2e-28) tmp = Float64(th * Float64(ky / hypot(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.1) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-139) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 2e-28) tmp = th * (ky / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.1], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-139], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-28], N[(th * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.1:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-139}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-28}:\\
\;\;\;\;th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.10000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 3.0%
add-sqr-sqrt2.1%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square27.3%
Simplified27.3%
if -0.10000000000000001 < (sin.f64 ky) < 1.00000000000000003e-139Initial program 84.1%
Taylor expanded in ky around 0 47.2%
if 1.00000000000000003e-139 < (sin.f64 ky) < 1.99999999999999994e-28Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.5%
associate-/r/99.8%
sin-neg99.8%
neg-mul-199.8%
associate-/r*99.8%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 99.5%
Taylor expanded in th around 0 50.0%
Taylor expanded in ky around 0 50.0%
if 1.99999999999999994e-28 < (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.5%
associate-/r/99.5%
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 55.3%
Final simplification44.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-119) (* (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) <= 5e-119) {
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) <= 5d-119) 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) <= 5e-119) {
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) <= 5e-119: 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) <= 5e-119) 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) <= 5e-119) 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], 5e-119], 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 5 \cdot 10^{-119}:\\
\;\;\;\;\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.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt2.0%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 83.6%
Taylor expanded in ky around 0 49.8%
if 4.99999999999999993e-119 < (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.5%
associate-/r/99.5%
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 51.8%
Final simplification44.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (* (sin th) (/ ky (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
}
return tmp;
}
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 {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) else: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); else tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); else tmp = sin(th) * (ky / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\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.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt2.0%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) Initial program 91.3%
remove-double-neg91.3%
sin-neg91.3%
neg-mul-191.3%
*-commutative91.3%
associate-*l*91.3%
associate-*l/90.2%
associate-/r/90.2%
associate-*l/91.3%
associate-/r/91.3%
sin-neg91.3%
neg-mul-191.3%
associate-/r*91.3%
associate-/r/91.3%
Simplified99.6%
Taylor expanded in ky around 0 64.5%
Taylor expanded in ky around 0 72.0%
Final simplification60.0%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.00033) (* (sin ky) (/ th (hypot (sin kx) (sin ky)))) (* (sin th) (/ ky (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00033) {
tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00033) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.00033: tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.00033) tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky)))); else tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.00033) tmp = sin(ky) * (th / hypot(sin(kx), sin(ky))); else tmp = sin(th) * (ky / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.00033], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.00033:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 3.3e-4Initial program 93.7%
remove-double-neg93.7%
sin-neg93.7%
neg-mul-193.7%
*-commutative93.7%
associate-*l*93.7%
associate-*l/92.6%
associate-/r/92.6%
associate-*l/93.7%
associate-/r/93.6%
sin-neg93.6%
neg-mul-193.6%
associate-/r*93.6%
associate-/r/93.7%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
hypot-udef93.7%
unpow293.7%
unpow293.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-def99.6%
Applied egg-rr99.6%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 66.7%
if 3.3e-4 < th Initial program 93.2%
remove-double-neg93.2%
sin-neg93.2%
neg-mul-193.2%
*-commutative93.2%
associate-*l*93.2%
associate-*l/93.0%
associate-/r/93.0%
associate-*l/93.2%
associate-/r/93.1%
sin-neg93.1%
neg-mul-193.1%
associate-/r*93.1%
associate-/r/93.2%
Simplified99.6%
Taylor expanded in ky around 0 55.6%
Taylor expanded in ky around 0 62.0%
Final simplification65.6%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0003) (/ th (/ (hypot (sin kx) (sin ky)) (sin ky))) (* (sin th) (/ ky (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0003) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0003) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0003: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) else: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0003) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); else tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0003) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); else tmp = sin(th) * (ky / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0003], 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[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0003:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 2.99999999999999974e-4Initial program 93.7%
remove-double-neg93.7%
sin-neg93.7%
neg-mul-193.7%
*-commutative93.7%
associate-*l*93.7%
associate-*l/92.6%
associate-/r/92.6%
associate-*l/93.7%
associate-/r/93.6%
sin-neg93.6%
neg-mul-193.6%
associate-/r*93.6%
associate-/r/93.7%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
hypot-udef93.7%
unpow293.7%
unpow293.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 66.8%
if 2.99999999999999974e-4 < th Initial program 93.2%
remove-double-neg93.2%
sin-neg93.2%
neg-mul-193.2%
*-commutative93.2%
associate-*l*93.2%
associate-*l/93.0%
associate-/r/93.0%
associate-*l/93.2%
associate-/r/93.1%
sin-neg93.1%
neg-mul-193.1%
associate-/r*93.1%
associate-/r/93.2%
Simplified99.6%
Taylor expanded in ky around 0 55.6%
Taylor expanded in ky around 0 62.0%
Final simplification65.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 2e-191) (/ ky (/ 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) <= 2e-191) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-191) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-191) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-191: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-191) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-191) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-191], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-191}:\\
\;\;\;\;\frac{ky}{\frac{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.5%
associate-/r/99.5%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt2.0%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square27.4%
Simplified27.4%
if -0.0200000000000000004 < (sin.f64 ky) < 2e-191Initial program 85.2%
remove-double-neg85.2%
sin-neg85.2%
neg-mul-185.2%
*-commutative85.2%
associate-*l*85.2%
associate-*l/83.0%
associate-/r/83.0%
associate-*l/85.2%
associate-/r/85.2%
sin-neg85.2%
neg-mul-185.2%
associate-/r*85.2%
associate-/r/85.2%
Simplified99.6%
associate-*l/93.2%
clear-num92.1%
hypot-udef82.1%
unpow282.1%
unpow282.1%
+-commutative82.1%
unpow282.1%
unpow282.1%
hypot-def92.1%
Applied egg-rr92.1%
Taylor expanded in ky around 0 49.3%
Taylor expanded in kx around 0 24.3%
associate-/r*25.9%
Simplified25.9%
Taylor expanded in ky around 0 24.3%
associate-/l*25.9%
Simplified25.9%
if 2e-191 < (sin.f64 ky) Initial program 96.9%
remove-double-neg96.9%
sin-neg96.9%
neg-mul-196.9%
*-commutative96.9%
associate-*l*96.9%
associate-*l/96.8%
associate-/r/96.8%
associate-*l/96.9%
associate-/r/96.8%
sin-neg96.8%
neg-mul-196.8%
associate-/r*96.8%
associate-/r/96.9%
Simplified99.6%
Taylor expanded in kx around 0 51.9%
Final simplification36.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.4e-182) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4e-182) {
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 <= 2.4d-182) 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 <= 2.4e-182) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.4e-182: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.4e-182) 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 <= 2.4e-182) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.4e-182], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.3999999999999998e-182Initial program 91.0%
remove-double-neg91.0%
sin-neg91.0%
neg-mul-191.0%
*-commutative91.0%
associate-*l*91.0%
associate-*l/89.7%
associate-/r/89.7%
associate-*l/91.0%
associate-/r/90.9%
sin-neg90.9%
neg-mul-190.9%
associate-/r*90.9%
associate-/r/91.0%
Simplified99.6%
associate-*l/95.7%
clear-num95.1%
hypot-udef89.1%
unpow289.1%
unpow289.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-def95.1%
Applied egg-rr95.1%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 15.9%
associate-/r*16.9%
Simplified16.9%
Taylor expanded in ky around 0 15.8%
associate-/l*16.8%
Simplified16.8%
if 2.3999999999999998e-182 < ky Initial program 97.1%
remove-double-neg97.1%
sin-neg97.1%
neg-mul-197.1%
*-commutative97.1%
associate-*l*97.1%
associate-*l/97.0%
associate-/r/97.0%
associate-*l/97.1%
associate-/r/97.1%
sin-neg97.1%
neg-mul-197.1%
associate-/r*97.1%
associate-/r/97.1%
Simplified99.6%
Taylor expanded in kx around 0 30.4%
Final simplification22.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 93.5%
remove-double-neg93.5%
sin-neg93.5%
neg-mul-193.5%
*-commutative93.5%
associate-*l*93.5%
associate-*l/92.7%
associate-/r/92.7%
associate-*l/93.5%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.5%
Simplified99.6%
Taylor expanded in kx around 0 22.3%
Final simplification22.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 93.5%
remove-double-neg93.5%
sin-neg93.5%
neg-mul-193.5%
*-commutative93.5%
associate-*l*93.5%
associate-*l/92.7%
associate-/r/92.7%
associate-*l/93.5%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.5%
Simplified99.6%
associate-*l/96.9%
clear-num96.4%
hypot-udef92.2%
unpow292.2%
unpow292.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def96.4%
Applied egg-rr96.4%
Taylor expanded in kx around 0 22.2%
Taylor expanded in th around 0 15.1%
Final simplification15.1%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 93.5%
remove-double-neg93.5%
sin-neg93.5%
neg-mul-193.5%
*-commutative93.5%
associate-*l*93.5%
associate-*l/92.7%
associate-/r/92.7%
associate-*l/93.5%
associate-/r/93.5%
sin-neg93.5%
neg-mul-193.5%
associate-/r*93.5%
associate-/r/93.5%
Simplified99.6%
Taylor expanded in kx around 0 22.3%
Taylor expanded in th around 0 14.5%
Final simplification14.5%
herbie shell --seed 2024011
(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)))