Toniolo and Linder, Equation (10-)

Percentage Accurate: 34.5% → 95.4%
Time: 17.7s
Alternatives: 5
Speedup: 2.0×

Specification

?
\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
	return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k):
	return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k)
	return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0)))
end
function tmp = code(t, l, k)
	tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0));
end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 34.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
	return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k):
	return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k)
	return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0)))
end
function tmp = code(t, l, k)
	tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0));
end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}

Alternative 1: 95.4% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;k_m \leq 1.5:\\ \;\;\;\;\frac{2}{{\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos k_m}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{\cos k_m}{t_m \cdot {\sin k_m}^{2}}\right)\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (*
  t_s
  (if (<= k_m 1.5)
    (/ 2.0 (pow (* (/ k_m (/ l (sin k_m))) (sqrt (/ t_m (cos k_m)))) 2.0))
    (*
     2.0
     (* (pow (/ l k_m) 2.0) (/ (cos k_m) (* t_m (pow (sin k_m) 2.0))))))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (k_m <= 1.5) {
		tmp = 2.0 / pow(((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))), 2.0);
	} else {
		tmp = 2.0 * (pow((l / k_m), 2.0) * (cos(k_m) / (t_m * pow(sin(k_m), 2.0))));
	}
	return t_s * tmp;
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    real(8) :: tmp
    if (k_m <= 1.5d0) then
        tmp = 2.0d0 / (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ** 2.0d0)
    else
        tmp = 2.0d0 * (((l / k_m) ** 2.0d0) * (cos(k_m) / (t_m * (sin(k_m) ** 2.0d0))))
    end if
    code = t_s * tmp
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (k_m <= 1.5) {
		tmp = 2.0 / Math.pow(((k_m / (l / Math.sin(k_m))) * Math.sqrt((t_m / Math.cos(k_m)))), 2.0);
	} else {
		tmp = 2.0 * (Math.pow((l / k_m), 2.0) * (Math.cos(k_m) / (t_m * Math.pow(Math.sin(k_m), 2.0))));
	}
	return t_s * tmp;
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	tmp = 0
	if k_m <= 1.5:
		tmp = 2.0 / math.pow(((k_m / (l / math.sin(k_m))) * math.sqrt((t_m / math.cos(k_m)))), 2.0)
	else:
		tmp = 2.0 * (math.pow((l / k_m), 2.0) * (math.cos(k_m) / (t_m * math.pow(math.sin(k_m), 2.0))))
	return t_s * tmp
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	tmp = 0.0
	if (k_m <= 1.5)
		tmp = Float64(2.0 / (Float64(Float64(k_m / Float64(l / sin(k_m))) * sqrt(Float64(t_m / cos(k_m)))) ^ 2.0));
	else
		tmp = Float64(2.0 * Float64((Float64(l / k_m) ^ 2.0) * Float64(cos(k_m) / Float64(t_m * (sin(k_m) ^ 2.0)))));
	end
	return Float64(t_s * tmp)
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k_m)
	tmp = 0.0;
	if (k_m <= 1.5)
		tmp = 2.0 / (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ^ 2.0);
	else
		tmp = 2.0 * (((l / k_m) ^ 2.0) * (cos(k_m) / (t_m * (sin(k_m) ^ 2.0))));
	end
	tmp_2 = t_s * tmp;
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * If[LessEqual[k$95$m, 1.5], N[(2.0 / N[Power[N[(N[(k$95$m / N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Cos[k$95$m], $MachinePrecision] / N[(t$95$m * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;k_m \leq 1.5:\\
\;\;\;\;\frac{2}{{\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos k_m}}\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{\cos k_m}{t_m \cdot {\sin k_m}^{2}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 1.5

    1. Initial program 37.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Applied egg-rr22.6%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left({\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}\right)}^{2}}}} \]
    3. Step-by-step derivation
      1. unpow222.6%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2} \cdot {\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}}}} \]
      2. pow-sqr22.6%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{\left(2 \cdot 2\right)}}}} \]
      3. associate-*l/23.1%

        \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)}{t}\right)}}^{\left(2 \cdot 2\right)}}} \]
      4. associate-*r/23.6%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{k \cdot \color{blue}{\frac{\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      5. associate-*r/24.1%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\color{blue}{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      6. metadata-eval24.1%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{\color{blue}{4}}}} \]
    4. Simplified24.1%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{4}}}} \]
    5. Taylor expanded in k around inf 34.0%

      \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}}^{4}}} \]
    6. Step-by-step derivation
      1. sqrt-pow138.6%

        \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}}} \]
      2. associate-/l*39.1%

        \[\leadsto \frac{2}{{\left(\color{blue}{\frac{k}{\frac{\ell}{\sin k}}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}} \]
      3. metadata-eval39.1%

        \[\leadsto \frac{2}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\color{blue}{2}}} \]
    7. Applied egg-rr39.1%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{2}}} \]

    if 1.5 < k

    1. Initial program 38.7%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. associate-/r*38.7%

        \[\leadsto \color{blue}{\frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1}} \]
      2. *-commutative38.7%

        \[\leadsto \frac{\frac{2}{\color{blue}{\left(\sin k \cdot \frac{{t}^{3}}{\ell \cdot \ell}\right)} \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
      3. associate-*l*38.6%

        \[\leadsto \frac{\frac{2}{\color{blue}{\sin k \cdot \left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \tan k\right)}}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
      4. associate-*l/38.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \color{blue}{\frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
      5. +-commutative38.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + 1\right)} - 1} \]
      6. unpow238.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\frac{k}{t} \cdot \frac{k}{t}} + 1\right) - 1} \]
      7. sqr-neg38.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\left(-\frac{k}{t}\right) \cdot \left(-\frac{k}{t}\right)} + 1\right) - 1} \]
      8. distribute-frac-neg38.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\frac{-k}{t}} \cdot \left(-\frac{k}{t}\right) + 1\right) - 1} \]
      9. distribute-frac-neg38.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\frac{-k}{t} \cdot \color{blue}{\frac{-k}{t}} + 1\right) - 1} \]
      10. unpow238.6%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{{\left(\frac{-k}{t}\right)}^{2}} + 1\right) - 1} \]
      11. associate--l+52.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{{\left(\frac{-k}{t}\right)}^{2} + \left(1 - 1\right)}} \]
      12. metadata-eval52.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{-k}{t}\right)}^{2} + \color{blue}{0}} \]
      13. +-rgt-identity52.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{{\left(\frac{-k}{t}\right)}^{2}}} \]
      14. unpow252.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\frac{-k}{t} \cdot \frac{-k}{t}}} \]
      15. distribute-frac-neg52.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\left(-\frac{k}{t}\right)} \cdot \frac{-k}{t}} \]
      16. distribute-frac-neg52.0%

        \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(-\frac{k}{t}\right) \cdot \color{blue}{\left(-\frac{k}{t}\right)}} \]
    3. Simplified52.0%

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Taylor expanded in k around inf 70.6%

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. times-frac72.3%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
    6. Simplified72.3%

      \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/72.3%

        \[\leadsto 2 \cdot \color{blue}{\frac{\frac{{\ell}^{2}}{{k}^{2}} \cdot \cos k}{t \cdot {\sin k}^{2}}} \]
      2. div-inv72.2%

        \[\leadsto 2 \cdot \frac{\color{blue}{\left({\ell}^{2} \cdot \frac{1}{{k}^{2}}\right)} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      3. pow-flip72.5%

        \[\leadsto 2 \cdot \frac{\left({\ell}^{2} \cdot \color{blue}{{k}^{\left(-2\right)}}\right) \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      4. metadata-eval72.5%

        \[\leadsto 2 \cdot \frac{\left({\ell}^{2} \cdot {k}^{\color{blue}{-2}}\right) \cdot \cos k}{t \cdot {\sin k}^{2}} \]
    8. Applied egg-rr72.5%

      \[\leadsto 2 \cdot \color{blue}{\frac{\left({\ell}^{2} \cdot {k}^{-2}\right) \cdot \cos k}{t \cdot {\sin k}^{2}}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt72.5%

        \[\leadsto 2 \cdot \frac{\color{blue}{\left(\sqrt{{\ell}^{2} \cdot {k}^{-2}} \cdot \sqrt{{\ell}^{2} \cdot {k}^{-2}}\right)} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      2. pow272.5%

        \[\leadsto 2 \cdot \frac{\color{blue}{{\left(\sqrt{{\ell}^{2} \cdot {k}^{-2}}\right)}^{2}} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      3. sqrt-prod72.4%

        \[\leadsto 2 \cdot \frac{{\color{blue}{\left(\sqrt{{\ell}^{2}} \cdot \sqrt{{k}^{-2}}\right)}}^{2} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      4. unpow272.4%

        \[\leadsto 2 \cdot \frac{{\left(\sqrt{\color{blue}{\ell \cdot \ell}} \cdot \sqrt{{k}^{-2}}\right)}^{2} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      5. sqrt-prod41.8%

        \[\leadsto 2 \cdot \frac{{\left(\color{blue}{\left(\sqrt{\ell} \cdot \sqrt{\ell}\right)} \cdot \sqrt{{k}^{-2}}\right)}^{2} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
      6. add-sqr-sqrt80.7%

        \[\leadsto 2 \cdot \frac{{\left(\color{blue}{\ell} \cdot \sqrt{{k}^{-2}}\right)}^{2} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
    10. Applied egg-rr80.7%

      \[\leadsto 2 \cdot \frac{\color{blue}{{\left(\ell \cdot \sqrt{{k}^{-2}}\right)}^{2}} \cdot \cos k}{t \cdot {\sin k}^{2}} \]
    11. Taylor expanded in l around 0 70.6%

      \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    12. Step-by-step derivation
      1. times-frac72.3%

        \[\leadsto 2 \cdot \color{blue}{\left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
      2. unpow272.3%

        \[\leadsto 2 \cdot \left(\frac{\color{blue}{\ell \cdot \ell}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      3. unpow272.3%

        \[\leadsto 2 \cdot \left(\frac{\ell \cdot \ell}{\color{blue}{k \cdot k}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      4. times-frac96.4%

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      5. *-lft-identity96.4%

        \[\leadsto 2 \cdot \left(\left(\frac{\color{blue}{1 \cdot \ell}}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      6. associate-*l/96.3%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{\left(\frac{1}{k} \cdot \ell\right)} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      7. *-lft-identity96.3%

        \[\leadsto 2 \cdot \left(\left(\left(\frac{1}{k} \cdot \ell\right) \cdot \frac{\color{blue}{1 \cdot \ell}}{k}\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      8. associate-*l/96.2%

        \[\leadsto 2 \cdot \left(\left(\left(\frac{1}{k} \cdot \ell\right) \cdot \color{blue}{\left(\frac{1}{k} \cdot \ell\right)}\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      9. unpow196.2%

        \[\leadsto 2 \cdot \left(\left(\color{blue}{{\left(\frac{1}{k} \cdot \ell\right)}^{1}} \cdot \left(\frac{1}{k} \cdot \ell\right)\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      10. pow-plus96.2%

        \[\leadsto 2 \cdot \left(\color{blue}{{\left(\frac{1}{k} \cdot \ell\right)}^{\left(1 + 1\right)}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      11. associate-*l/96.4%

        \[\leadsto 2 \cdot \left({\color{blue}{\left(\frac{1 \cdot \ell}{k}\right)}}^{\left(1 + 1\right)} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      12. *-lft-identity96.4%

        \[\leadsto 2 \cdot \left({\left(\frac{\color{blue}{\ell}}{k}\right)}^{\left(1 + 1\right)} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
      13. metadata-eval96.4%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{\color{blue}{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \]
    13. Simplified96.4%

      \[\leadsto 2 \cdot \color{blue}{\left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1.5:\\ \;\;\;\;\frac{2}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)\\ \end{array} \]

Alternative 2: 91.4% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := \frac{t_m}{\cos k_m}\\ t_s \cdot \begin{array}{l} \mathbf{if}\;t_m \leq 1.9 \cdot 10^{-261}:\\ \;\;\;\;\frac{2}{{\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{t_2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t_2 \cdot {\left(\sin k_m \cdot \frac{k_m}{\ell}\right)}^{2}}\\ \end{array} \end{array} \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (let* ((t_2 (/ t_m (cos k_m))))
   (*
    t_s
    (if (<= t_m 1.9e-261)
      (/ 2.0 (pow (* (/ k_m (/ l (sin k_m))) (sqrt t_2)) 2.0))
      (/ 2.0 (* t_2 (pow (* (sin k_m) (/ k_m l)) 2.0)))))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double t_2 = t_m / cos(k_m);
	double tmp;
	if (t_m <= 1.9e-261) {
		tmp = 2.0 / pow(((k_m / (l / sin(k_m))) * sqrt(t_2)), 2.0);
	} else {
		tmp = 2.0 / (t_2 * pow((sin(k_m) * (k_m / l)), 2.0));
	}
	return t_s * tmp;
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    real(8) :: t_2
    real(8) :: tmp
    t_2 = t_m / cos(k_m)
    if (t_m <= 1.9d-261) then
        tmp = 2.0d0 / (((k_m / (l / sin(k_m))) * sqrt(t_2)) ** 2.0d0)
    else
        tmp = 2.0d0 / (t_2 * ((sin(k_m) * (k_m / l)) ** 2.0d0))
    end if
    code = t_s * tmp
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	double t_2 = t_m / Math.cos(k_m);
	double tmp;
	if (t_m <= 1.9e-261) {
		tmp = 2.0 / Math.pow(((k_m / (l / Math.sin(k_m))) * Math.sqrt(t_2)), 2.0);
	} else {
		tmp = 2.0 / (t_2 * Math.pow((Math.sin(k_m) * (k_m / l)), 2.0));
	}
	return t_s * tmp;
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	t_2 = t_m / math.cos(k_m)
	tmp = 0
	if t_m <= 1.9e-261:
		tmp = 2.0 / math.pow(((k_m / (l / math.sin(k_m))) * math.sqrt(t_2)), 2.0)
	else:
		tmp = 2.0 / (t_2 * math.pow((math.sin(k_m) * (k_m / l)), 2.0))
	return t_s * tmp
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	t_2 = Float64(t_m / cos(k_m))
	tmp = 0.0
	if (t_m <= 1.9e-261)
		tmp = Float64(2.0 / (Float64(Float64(k_m / Float64(l / sin(k_m))) * sqrt(t_2)) ^ 2.0));
	else
		tmp = Float64(2.0 / Float64(t_2 * (Float64(sin(k_m) * Float64(k_m / l)) ^ 2.0)));
	end
	return Float64(t_s * tmp)
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k_m)
	t_2 = t_m / cos(k_m);
	tmp = 0.0;
	if (t_m <= 1.9e-261)
		tmp = 2.0 / (((k_m / (l / sin(k_m))) * sqrt(t_2)) ^ 2.0);
	else
		tmp = 2.0 / (t_2 * ((sin(k_m) * (k_m / l)) ^ 2.0));
	end
	tmp_2 = t_s * tmp;
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := Block[{t$95$2 = N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.9e-261], N[(2.0 / N[Power[N[(N[(k$95$m / N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$2 * N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \frac{t_m}{\cos k_m}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.9 \cdot 10^{-261}:\\
\;\;\;\;\frac{2}{{\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{t_2}\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{t_2 \cdot {\left(\sin k_m \cdot \frac{k_m}{\ell}\right)}^{2}}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.9e-261

    1. Initial program 37.2%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Applied egg-rr1.4%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left({\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}\right)}^{2}}}} \]
    3. Step-by-step derivation
      1. unpow21.4%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2} \cdot {\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}}}} \]
      2. pow-sqr1.4%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{\left(2 \cdot 2\right)}}}} \]
      3. associate-*l/1.4%

        \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)}{t}\right)}}^{\left(2 \cdot 2\right)}}} \]
      4. associate-*r/1.4%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{k \cdot \color{blue}{\frac{\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      5. associate-*r/1.4%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\color{blue}{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      6. metadata-eval1.4%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{\color{blue}{4}}}} \]
    4. Simplified1.4%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{4}}}} \]
    5. Taylor expanded in k around inf 21.0%

      \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}}^{4}}} \]
    6. Step-by-step derivation
      1. sqrt-pow124.5%

        \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}}} \]
      2. associate-/l*24.5%

        \[\leadsto \frac{2}{{\left(\color{blue}{\frac{k}{\frac{\ell}{\sin k}}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}} \]
      3. metadata-eval24.5%

        \[\leadsto \frac{2}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\color{blue}{2}}} \]
    7. Applied egg-rr24.5%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{2}}} \]

    if 1.9e-261 < t

    1. Initial program 38.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Applied egg-rr48.5%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left({\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}\right)}^{2}}}} \]
    3. Step-by-step derivation
      1. unpow248.5%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2} \cdot {\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}}}} \]
      2. pow-sqr48.5%

        \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{\left(2 \cdot 2\right)}}}} \]
      3. associate-*l/50.4%

        \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)}{t}\right)}}^{\left(2 \cdot 2\right)}}} \]
      4. associate-*r/51.4%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{k \cdot \color{blue}{\frac{\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      5. associate-*r/52.3%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\color{blue}{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
      6. metadata-eval52.3%

        \[\leadsto \frac{2}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{\color{blue}{4}}}} \]
    4. Simplified52.3%

      \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{4}}}} \]
    5. Taylor expanded in k around inf 56.2%

      \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}}^{4}}} \]
    6. Step-by-step derivation
      1. expm1-log1p-u55.9%

        \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{4}}\right)\right)}} \]
      2. expm1-udef52.2%

        \[\leadsto \frac{2}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{4}}\right)} - 1}} \]
      3. sqrt-pow155.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}}\right)} - 1} \]
      4. *-commutative55.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left({\color{blue}{\left(\sqrt{\frac{t}{\cos k}} \cdot \frac{k \cdot \sin k}{\ell}\right)}}^{\left(\frac{4}{2}\right)}\right)} - 1} \]
      5. metadata-eval55.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left({\left(\sqrt{\frac{t}{\cos k}} \cdot \frac{k \cdot \sin k}{\ell}\right)}^{\color{blue}{2}}\right)} - 1} \]
      6. unpow-prod-down55.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{{\left(\sqrt{\frac{t}{\cos k}}\right)}^{2} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}}\right)} - 1} \]
      7. pow255.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{\frac{t}{\cos k}} \cdot \sqrt{\frac{t}{\cos k}}\right)} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}\right)} - 1} \]
      8. add-sqr-sqrt55.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{\frac{t}{\cos k}} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}\right)} - 1} \]
      9. associate-/l*55.5%

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\color{blue}{\left(\frac{k}{\frac{\ell}{\sin k}}\right)}}^{2}\right)} - 1} \]
    7. Applied egg-rr55.5%

      \[\leadsto \frac{2}{\color{blue}{e^{\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}\right)} - 1}} \]
    8. Step-by-step derivation
      1. expm1-def71.7%

        \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}\right)\right)}} \]
      2. expm1-log1p96.0%

        \[\leadsto \frac{2}{\color{blue}{\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}}} \]
      3. associate-/r/96.0%

        \[\leadsto \frac{2}{\frac{t}{\cos k} \cdot {\color{blue}{\left(\frac{k}{\ell} \cdot \sin k\right)}}^{2}} \]
    9. Simplified96.0%

      \[\leadsto \frac{2}{\color{blue}{\frac{t}{\cos k} \cdot {\left(\frac{k}{\ell} \cdot \sin k\right)}^{2}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.9 \cdot 10^{-261}:\\ \;\;\;\;\frac{2}{{\left(\frac{k}{\frac{\ell}{\sin k}} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{t}{\cos k} \cdot {\left(\sin k \cdot \frac{k}{\ell}\right)}^{2}}\\ \end{array} \]

Alternative 3: 92.7% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \frac{2}{\frac{t_m}{\cos k_m} \cdot {\left(\sin k_m \cdot \frac{k_m}{\ell}\right)}^{2}} \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (* t_s (/ 2.0 (* (/ t_m (cos k_m)) (pow (* (sin k_m) (/ k_m l)) 2.0)))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * (2.0 / ((t_m / cos(k_m)) * pow((sin(k_m) * (k_m / l)), 2.0)));
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    code = t_s * (2.0d0 / ((t_m / cos(k_m)) * ((sin(k_m) * (k_m / l)) ** 2.0d0)))
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	return t_s * (2.0 / ((t_m / Math.cos(k_m)) * Math.pow((Math.sin(k_m) * (k_m / l)), 2.0)));
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	return t_s * (2.0 / ((t_m / math.cos(k_m)) * math.pow((math.sin(k_m) * (k_m / l)), 2.0)))
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	return Float64(t_s * Float64(2.0 / Float64(Float64(t_m / cos(k_m)) * (Float64(sin(k_m) * Float64(k_m / l)) ^ 2.0))))
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k_m)
	tmp = t_s * (2.0 / ((t_m / cos(k_m)) * ((sin(k_m) * (k_m / l)) ^ 2.0)));
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(2.0 / N[(N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \frac{2}{\frac{t_m}{\cos k_m} \cdot {\left(\sin k_m \cdot \frac{k_m}{\ell}\right)}^{2}}
\end{array}
Derivation
  1. Initial program 37.7%

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Applied egg-rr20.1%

    \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left({\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}\right)}^{2}}}} \]
  3. Step-by-step derivation
    1. unpow220.1%

      \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2} \cdot {\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{2}}}} \]
    2. pow-sqr20.1%

      \[\leadsto \frac{2}{\sqrt{\color{blue}{{\left(\frac{k}{t} \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)\right)}^{\left(2 \cdot 2\right)}}}} \]
    3. associate-*l/20.9%

      \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot \frac{{t}^{1.5}}{\ell}\right)}{t}\right)}}^{\left(2 \cdot 2\right)}}} \]
    4. associate-*r/21.3%

      \[\leadsto \frac{2}{\sqrt{{\left(\frac{k \cdot \color{blue}{\frac{\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
    5. associate-*r/21.7%

      \[\leadsto \frac{2}{\sqrt{{\left(\frac{\color{blue}{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}}{t}\right)}^{\left(2 \cdot 2\right)}}} \]
    6. metadata-eval21.7%

      \[\leadsto \frac{2}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{\color{blue}{4}}}} \]
  4. Simplified21.7%

    \[\leadsto \frac{2}{\color{blue}{\sqrt{{\left(\frac{\frac{k \cdot \left(\sqrt{\sin k \cdot \tan k} \cdot {t}^{1.5}\right)}{\ell}}{t}\right)}^{4}}}} \]
  5. Taylor expanded in k around inf 35.0%

    \[\leadsto \frac{2}{\sqrt{{\color{blue}{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}}^{4}}} \]
  6. Step-by-step derivation
    1. expm1-log1p-u34.7%

      \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{4}}\right)\right)}} \]
    2. expm1-udef31.4%

      \[\leadsto \frac{2}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{4}}\right)} - 1}} \]
    3. sqrt-pow134.6%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{k \cdot \sin k}{\ell} \cdot \sqrt{\frac{t}{\cos k}}\right)}^{\left(\frac{4}{2}\right)}}\right)} - 1} \]
    4. *-commutative34.6%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left({\color{blue}{\left(\sqrt{\frac{t}{\cos k}} \cdot \frac{k \cdot \sin k}{\ell}\right)}}^{\left(\frac{4}{2}\right)}\right)} - 1} \]
    5. metadata-eval34.6%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left({\left(\sqrt{\frac{t}{\cos k}} \cdot \frac{k \cdot \sin k}{\ell}\right)}^{\color{blue}{2}}\right)} - 1} \]
    6. unpow-prod-down33.3%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{{\left(\sqrt{\frac{t}{\cos k}}\right)}^{2} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}}\right)} - 1} \]
    7. pow233.3%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{\left(\sqrt{\frac{t}{\cos k}} \cdot \sqrt{\frac{t}{\cos k}}\right)} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}\right)} - 1} \]
    8. add-sqr-sqrt33.7%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{\frac{t}{\cos k}} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}\right)} - 1} \]
    9. associate-/l*33.7%

      \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\color{blue}{\left(\frac{k}{\frac{\ell}{\sin k}}\right)}}^{2}\right)} - 1} \]
  7. Applied egg-rr33.7%

    \[\leadsto \frac{2}{\color{blue}{e^{\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}\right)} - 1}} \]
  8. Step-by-step derivation
    1. expm1-def71.2%

      \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}\right)\right)}} \]
    2. expm1-log1p94.9%

      \[\leadsto \frac{2}{\color{blue}{\frac{t}{\cos k} \cdot {\left(\frac{k}{\frac{\ell}{\sin k}}\right)}^{2}}} \]
    3. associate-/r/94.9%

      \[\leadsto \frac{2}{\frac{t}{\cos k} \cdot {\color{blue}{\left(\frac{k}{\ell} \cdot \sin k\right)}}^{2}} \]
  9. Simplified94.9%

    \[\leadsto \frac{2}{\color{blue}{\frac{t}{\cos k} \cdot {\left(\frac{k}{\ell} \cdot \sin k\right)}^{2}}} \]
  10. Final simplification94.9%

    \[\leadsto \frac{2}{\frac{t}{\cos k} \cdot {\left(\sin k \cdot \frac{k}{\ell}\right)}^{2}} \]

Alternative 4: 66.6% accurate, 1.4× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \left(\frac{2}{t_m} \cdot {\left(\ell \cdot \sqrt{{k_m}^{-4}}\right)}^{2}\right) \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (* t_s (* (/ 2.0 t_m) (pow (* l (sqrt (pow k_m -4.0))) 2.0))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * ((2.0 / t_m) * pow((l * sqrt(pow(k_m, -4.0))), 2.0));
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    code = t_s * ((2.0d0 / t_m) * ((l * sqrt((k_m ** (-4.0d0)))) ** 2.0d0))
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	return t_s * ((2.0 / t_m) * Math.pow((l * Math.sqrt(Math.pow(k_m, -4.0))), 2.0));
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	return t_s * ((2.0 / t_m) * math.pow((l * math.sqrt(math.pow(k_m, -4.0))), 2.0))
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	return Float64(t_s * Float64(Float64(2.0 / t_m) * (Float64(l * sqrt((k_m ^ -4.0))) ^ 2.0)))
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k_m)
	tmp = t_s * ((2.0 / t_m) * ((l * sqrt((k_m ^ -4.0))) ^ 2.0));
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(N[(2.0 / t$95$m), $MachinePrecision] * N[Power[N[(l * N[Sqrt[N[Power[k$95$m, -4.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \left(\frac{2}{t_m} \cdot {\left(\ell \cdot \sqrt{{k_m}^{-4}}\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 37.7%

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Step-by-step derivation
    1. +-commutative37.7%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + 1\right)} - 1\right)} \]
    2. associate--l+46.8%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + \left(1 - 1\right)\right)}} \]
    3. metadata-eval46.8%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left({\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}\right)} \]
    4. +-rgt-identity46.8%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \color{blue}{{\left(\frac{k}{t}\right)}^{2}}} \]
    5. unpow246.8%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \color{blue}{\left(\frac{k}{t} \cdot \frac{k}{t}\right)}} \]
    6. div-inv46.7%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\frac{k}{t} \cdot \color{blue}{\left(k \cdot \frac{1}{t}\right)}\right)} \]
    7. associate-*r*46.7%

      \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \color{blue}{\left(\left(\frac{k}{t} \cdot k\right) \cdot \frac{1}{t}\right)}} \]
  3. Applied egg-rr46.7%

    \[\leadsto \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \color{blue}{\left(\left(\frac{k}{t} \cdot k\right) \cdot \frac{1}{t}\right)}} \]
  4. Taylor expanded in k around 0 62.5%

    \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{4} \cdot t}{{\ell}^{2}}}} \]
  5. Step-by-step derivation
    1. *-commutative62.5%

      \[\leadsto \frac{2}{\frac{\color{blue}{t \cdot {k}^{4}}}{{\ell}^{2}}} \]
    2. associate-/l*62.2%

      \[\leadsto \frac{2}{\color{blue}{\frac{t}{\frac{{\ell}^{2}}{{k}^{4}}}}} \]
  6. Simplified62.2%

    \[\leadsto \frac{2}{\color{blue}{\frac{t}{\frac{{\ell}^{2}}{{k}^{4}}}}} \]
  7. Taylor expanded in t around 0 62.5%

    \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
  8. Step-by-step derivation
    1. associate-*r/62.5%

      \[\leadsto \color{blue}{\frac{2 \cdot {\ell}^{2}}{{k}^{4} \cdot t}} \]
    2. *-commutative62.5%

      \[\leadsto \frac{2 \cdot {\ell}^{2}}{\color{blue}{t \cdot {k}^{4}}} \]
    3. times-frac62.3%

      \[\leadsto \color{blue}{\frac{2}{t} \cdot \frac{{\ell}^{2}}{{k}^{4}}} \]
  9. Simplified62.3%

    \[\leadsto \color{blue}{\frac{2}{t} \cdot \frac{{\ell}^{2}}{{k}^{4}}} \]
  10. Step-by-step derivation
    1. add-sqr-sqrt62.2%

      \[\leadsto \frac{2}{t} \cdot \color{blue}{\left(\sqrt{\frac{{\ell}^{2}}{{k}^{4}}} \cdot \sqrt{\frac{{\ell}^{2}}{{k}^{4}}}\right)} \]
    2. pow262.2%

      \[\leadsto \frac{2}{t} \cdot \color{blue}{{\left(\sqrt{\frac{{\ell}^{2}}{{k}^{4}}}\right)}^{2}} \]
    3. div-inv62.2%

      \[\leadsto \frac{2}{t} \cdot {\left(\sqrt{\color{blue}{{\ell}^{2} \cdot \frac{1}{{k}^{4}}}}\right)}^{2} \]
    4. sqrt-prod62.2%

      \[\leadsto \frac{2}{t} \cdot {\color{blue}{\left(\sqrt{{\ell}^{2}} \cdot \sqrt{\frac{1}{{k}^{4}}}\right)}}^{2} \]
    5. unpow262.2%

      \[\leadsto \frac{2}{t} \cdot {\left(\sqrt{\color{blue}{\ell \cdot \ell}} \cdot \sqrt{\frac{1}{{k}^{4}}}\right)}^{2} \]
    6. sqrt-prod37.5%

      \[\leadsto \frac{2}{t} \cdot {\left(\color{blue}{\left(\sqrt{\ell} \cdot \sqrt{\ell}\right)} \cdot \sqrt{\frac{1}{{k}^{4}}}\right)}^{2} \]
    7. add-sqr-sqrt69.0%

      \[\leadsto \frac{2}{t} \cdot {\left(\color{blue}{\ell} \cdot \sqrt{\frac{1}{{k}^{4}}}\right)}^{2} \]
    8. pow-flip69.0%

      \[\leadsto \frac{2}{t} \cdot {\left(\ell \cdot \sqrt{\color{blue}{{k}^{\left(-4\right)}}}\right)}^{2} \]
    9. metadata-eval69.0%

      \[\leadsto \frac{2}{t} \cdot {\left(\ell \cdot \sqrt{{k}^{\color{blue}{-4}}}\right)}^{2} \]
  11. Applied egg-rr69.0%

    \[\leadsto \frac{2}{t} \cdot \color{blue}{{\left(\ell \cdot \sqrt{{k}^{-4}}\right)}^{2}} \]
  12. Final simplification69.0%

    \[\leadsto \frac{2}{t} \cdot {\left(\ell \cdot \sqrt{{k}^{-4}}\right)}^{2} \]

Alternative 5: 60.9% accurate, 2.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \left(2 \cdot \frac{{\ell}^{2}}{t_m \cdot {k_m}^{4}}\right) \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (* t_s (* 2.0 (/ (pow l 2.0) (* t_m (pow k_m 4.0))))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * (2.0 * (pow(l, 2.0) / (t_m * pow(k_m, 4.0))));
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    code = t_s * (2.0d0 * ((l ** 2.0d0) / (t_m * (k_m ** 4.0d0))))
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	return t_s * (2.0 * (Math.pow(l, 2.0) / (t_m * Math.pow(k_m, 4.0))));
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	return t_s * (2.0 * (math.pow(l, 2.0) / (t_m * math.pow(k_m, 4.0))))
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	return Float64(t_s * Float64(2.0 * Float64((l ^ 2.0) / Float64(t_m * (k_m ^ 4.0)))))
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k_m)
	tmp = t_s * (2.0 * ((l ^ 2.0) / (t_m * (k_m ^ 4.0))));
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / N[(t$95$m * N[Power[k$95$m, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \left(2 \cdot \frac{{\ell}^{2}}{t_m \cdot {k_m}^{4}}\right)
\end{array}
Derivation
  1. Initial program 37.7%

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Step-by-step derivation
    1. associate-/r*37.7%

      \[\leadsto \color{blue}{\frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1}} \]
    2. *-commutative37.7%

      \[\leadsto \frac{\frac{2}{\color{blue}{\left(\sin k \cdot \frac{{t}^{3}}{\ell \cdot \ell}\right)} \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
    3. associate-*l*37.7%

      \[\leadsto \frac{\frac{2}{\color{blue}{\sin k \cdot \left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \tan k\right)}}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
    4. associate-*l/38.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \color{blue}{\frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1} \]
    5. +-commutative38.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + 1\right)} - 1} \]
    6. unpow238.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\frac{k}{t} \cdot \frac{k}{t}} + 1\right) - 1} \]
    7. sqr-neg38.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\left(-\frac{k}{t}\right) \cdot \left(-\frac{k}{t}\right)} + 1\right) - 1} \]
    8. distribute-frac-neg38.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{\frac{-k}{t}} \cdot \left(-\frac{k}{t}\right) + 1\right) - 1} \]
    9. distribute-frac-neg38.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\frac{-k}{t} \cdot \color{blue}{\frac{-k}{t}} + 1\right) - 1} \]
    10. unpow238.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(\color{blue}{{\left(\frac{-k}{t}\right)}^{2}} + 1\right) - 1} \]
    11. associate--l+47.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{{\left(\frac{-k}{t}\right)}^{2} + \left(1 - 1\right)}} \]
    12. metadata-eval47.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{-k}{t}\right)}^{2} + \color{blue}{0}} \]
    13. +-rgt-identity47.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{{\left(\frac{-k}{t}\right)}^{2}}} \]
    14. unpow247.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\frac{-k}{t} \cdot \frac{-k}{t}}} \]
    15. distribute-frac-neg47.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\color{blue}{\left(-\frac{k}{t}\right)} \cdot \frac{-k}{t}} \]
    16. distribute-frac-neg47.1%

      \[\leadsto \frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{\left(-\frac{k}{t}\right) \cdot \color{blue}{\left(-\frac{k}{t}\right)}} \]
  3. Simplified47.1%

    \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
  4. Taylor expanded in k around 0 62.5%

    \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
  5. Final simplification62.5%

    \[\leadsto 2 \cdot \frac{{\ell}^{2}}{t \cdot {k}^{4}} \]

Reproduce

?
herbie shell --seed 2023334 
(FPCore (t l k)
  :name "Toniolo and Linder, Equation (10-)"
  :precision binary64
  (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))