Toniolo and Linder, Equation (10-)

Percentage Accurate: 34.2% → 93.2%
Time: 34.1s
Alternatives: 8
Speedup: 38.3×

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 8 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.2% 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: 93.2% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} t_1 := {\sin k}^{2}\\ \mathbf{if}\;k \leq 4.3 \cdot 10^{-138}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{elif}\;k \leq 5.5 \cdot 10^{+112}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{\frac{k}{\frac{\ell}{k \cdot t}} \cdot t_1}{\ell \cdot \cos k}}\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (let* ((t_1 (pow (sin k) 2.0)))
   (if (<= k 4.3e-138)
     (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l))))
     (if (<= k 5.5e+112)
       (* 2.0 (* (/ (cos k) t_1) (* (/ l t) (/ l (* k k)))))
       (/ 2.0 (/ (* (/ k (/ l (* k t))) t_1) (* l (cos k))))))))
k = abs(k);
double code(double t, double l, double k) {
	double t_1 = pow(sin(k), 2.0);
	double tmp;
	if (k <= 4.3e-138) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else if (k <= 5.5e+112) {
		tmp = 2.0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k))));
	} else {
		tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * cos(k)));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sin(k) ** 2.0d0
    if (k <= 4.3d-138) then
        tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
    else if (k <= 5.5d+112) then
        tmp = 2.0d0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k))))
    else
        tmp = 2.0d0 / (((k / (l / (k * t))) * t_1) / (l * cos(k)))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double t_1 = Math.pow(Math.sin(k), 2.0);
	double tmp;
	if (k <= 4.3e-138) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else if (k <= 5.5e+112) {
		tmp = 2.0 * ((Math.cos(k) / t_1) * ((l / t) * (l / (k * k))));
	} else {
		tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * Math.cos(k)));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	t_1 = math.pow(math.sin(k), 2.0)
	tmp = 0
	if k <= 4.3e-138:
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)))
	elif k <= 5.5e+112:
		tmp = 2.0 * ((math.cos(k) / t_1) * ((l / t) * (l / (k * k))))
	else:
		tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * math.cos(k)))
	return tmp
k = abs(k)
function code(t, l, k)
	t_1 = sin(k) ^ 2.0
	tmp = 0.0
	if (k <= 4.3e-138)
		tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l))));
	elseif (k <= 5.5e+112)
		tmp = Float64(2.0 * Float64(Float64(cos(k) / t_1) * Float64(Float64(l / t) * Float64(l / Float64(k * k)))));
	else
		tmp = Float64(2.0 / Float64(Float64(Float64(k / Float64(l / Float64(k * t))) * t_1) / Float64(l * cos(k))));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	t_1 = sin(k) ^ 2.0;
	tmp = 0.0;
	if (k <= 4.3e-138)
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	elseif (k <= 5.5e+112)
		tmp = 2.0 * ((cos(k) / t_1) * ((l / t) * (l / (k * k))));
	else
		tmp = 2.0 / (((k / (l / (k * t))) * t_1) / (l * cos(k)));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 4.3e-138], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5.5e+112], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;k \leq 4.3 \cdot 10^{-138}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\

\mathbf{elif}\;k \leq 5.5 \cdot 10^{+112}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{k}{\frac{\ell}{k \cdot t}} \cdot t_1}{\ell \cdot \cos k}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if k < 4.3e-138

    1. Initial program 30.3%

      \[\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. Taylor expanded in t around 0 73.4%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow287.2%

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\frac{{k}^{2}}{\ell}}} \]
    8. Step-by-step derivation
      1. unpow275.7%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \frac{\color{blue}{k \cdot k}}{\ell}} \]
      2. associate-*l/78.2%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left(\frac{k}{\ell} \cdot k\right)}} \]
      3. *-commutative78.2%

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

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

    if 4.3e-138 < k < 5.50000000000000026e112

    1. Initial program 27.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. Step-by-step derivation
      1. associate-/r*27.4%

        \[\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. *-commutative27.4%

        \[\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-/r*27.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\frac{\sin k}{\frac{\ell}{\frac{{t}^{3}}{\ell}}} \cdot \tan k}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Taylor expanded in k around inf 80.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. associate-*r*80.5%

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

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

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

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

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

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

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

    if 5.50000000000000026e112 < k

    1. Initial program 41.3%

      \[\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. Taylor expanded in t around 0 68.1%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow270.6%

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

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

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

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

        \[\leadsto \frac{2}{\frac{\color{blue}{\frac{k}{\frac{\ell}{k \cdot t}}} \cdot {\sin k}^{2}}{\ell \cdot \cos k}} \]
    6. Applied egg-rr93.7%

      \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k}{\frac{\ell}{k \cdot t}} \cdot {\sin k}^{2}}{\ell \cdot \cos k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 4.3 \cdot 10^{-138}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{elif}\;k \leq 5.5 \cdot 10^{+112}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{{\sin k}^{2}} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{\frac{k}{\frac{\ell}{k \cdot t}} \cdot {\sin k}^{2}}{\ell \cdot \cos k}}\\ \end{array} \]

Alternative 2: 94.9% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} t_1 := \sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}}\\ \mathbf{if}\;k \leq 6 \cdot 10^{-14}:\\ \;\;\;\;\frac{2}{\left(t_1 \cdot \left(t_1 \cdot t_1\right)\right) \cdot \frac{k}{\frac{\ell}{k}}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{k} \cdot \left(\ell \cdot \frac{\frac{\ell}{k}}{t}\right)\right) \cdot \frac{\cos k}{{\sin k}^{2}}\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (let* ((t_1 (cbrt (/ k (/ l (* k t))))))
   (if (<= k 6e-14)
     (/ 2.0 (* (* t_1 (* t_1 t_1)) (/ k (/ l k))))
     (* (* (/ 2.0 k) (* l (/ (/ l k) t))) (/ (cos k) (pow (sin k) 2.0))))))
k = abs(k);
double code(double t, double l, double k) {
	double t_1 = cbrt((k / (l / (k * t))));
	double tmp;
	if (k <= 6e-14) {
		tmp = 2.0 / ((t_1 * (t_1 * t_1)) * (k / (l / k)));
	} else {
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * (cos(k) / pow(sin(k), 2.0));
	}
	return tmp;
}
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double t_1 = Math.cbrt((k / (l / (k * t))));
	double tmp;
	if (k <= 6e-14) {
		tmp = 2.0 / ((t_1 * (t_1 * t_1)) * (k / (l / k)));
	} else {
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * (Math.cos(k) / Math.pow(Math.sin(k), 2.0));
	}
	return tmp;
}
k = abs(k)
function code(t, l, k)
	t_1 = cbrt(Float64(k / Float64(l / Float64(k * t))))
	tmp = 0.0
	if (k <= 6e-14)
		tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(t_1 * t_1)) * Float64(k / Float64(l / k))));
	else
		tmp = Float64(Float64(Float64(2.0 / k) * Float64(l * Float64(Float64(l / k) / t))) * Float64(cos(k) / (sin(k) ^ 2.0)));
	end
	return tmp
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(k / N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[k, 6e-14], N[(2.0 / N[(N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / k), $MachinePrecision] * N[(l * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}}\\
\mathbf{if}\;k \leq 6 \cdot 10^{-14}:\\
\;\;\;\;\frac{2}{\left(t_1 \cdot \left(t_1 \cdot t_1\right)\right) \cdot \frac{k}{\frac{\ell}{k}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 5.9999999999999997e-14

    1. Initial program 31.6%

      \[\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. Taylor expanded in t around 0 74.3%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow287.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(\sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}} \cdot \sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}}\right) \cdot \sqrt[3]{\frac{k}{\frac{\ell}{k \cdot t}}}\right) \cdot \color{blue}{\frac{k}{\frac{\ell}{k}}}} \]
    9. Simplified82.3%

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

    if 5.9999999999999997e-14 < k

    1. Initial program 32.3%

      \[\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. Taylor expanded in t around 0 72.9%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow275.7%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 72.9%

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{{\ell}^{2}}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      6. unpow278.3%

        \[\leadsto \frac{2}{\frac{k}{\frac{\color{blue}{\ell \cdot \ell}}{k \cdot t}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      7. associate-/l*85.9%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\ell}{\frac{k \cdot t}{\ell}}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      8. associate-/r/85.9%

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

        \[\leadsto \frac{2}{\frac{k}{\frac{\ell}{\color{blue}{t \cdot k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      10. associate-/r*88.5%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\frac{\ell}{t}}{k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
    9. Simplified88.5%

      \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{\frac{\ell}{t}}{k} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}}} \]
    10. Taylor expanded in k around inf 72.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{{\ell}^{2}}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      8. unpow278.3%

        \[\leadsto \frac{2}{\frac{k}{\frac{\color{blue}{\ell \cdot \ell}}{k \cdot t}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      9. associate-*r/85.9%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\ell \cdot \frac{\ell}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      10. associate-*r/85.9%

        \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}} \cdot {\sin k}^{2}}{\cos k}}} \]
      11. associate-/l*85.8%

        \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}}}{\frac{\cos k}{{\sin k}^{2}}}}} \]
      12. associate-/r/85.9%

        \[\leadsto \color{blue}{\frac{2}{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}}} \cdot \frac{\cos k}{{\sin k}^{2}}} \]
    12. Simplified93.3%

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

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

Alternative 3: 92.6% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} t_1 := {\sin k}^{2}\\ \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+135}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(t \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)\right) \cdot \frac{t_1}{\cos k}}\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (let* ((t_1 (pow (sin k) 2.0)))
   (if (<= (* l l) 5e+135)
     (* 2.0 (* (/ (cos k) t_1) (/ l (* k (/ k (/ l t))))))
     (/ 2.0 (* (* t (* (/ k l) (/ k l))) (/ t_1 (cos k)))))))
k = abs(k);
double code(double t, double l, double k) {
	double t_1 = pow(sin(k), 2.0);
	double tmp;
	if ((l * l) <= 5e+135) {
		tmp = 2.0 * ((cos(k) / t_1) * (l / (k * (k / (l / t)))));
	} else {
		tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k)));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sin(k) ** 2.0d0
    if ((l * l) <= 5d+135) then
        tmp = 2.0d0 * ((cos(k) / t_1) * (l / (k * (k / (l / t)))))
    else
        tmp = 2.0d0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k)))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double t_1 = Math.pow(Math.sin(k), 2.0);
	double tmp;
	if ((l * l) <= 5e+135) {
		tmp = 2.0 * ((Math.cos(k) / t_1) * (l / (k * (k / (l / t)))));
	} else {
		tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / Math.cos(k)));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	t_1 = math.pow(math.sin(k), 2.0)
	tmp = 0
	if (l * l) <= 5e+135:
		tmp = 2.0 * ((math.cos(k) / t_1) * (l / (k * (k / (l / t)))))
	else:
		tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / math.cos(k)))
	return tmp
k = abs(k)
function code(t, l, k)
	t_1 = sin(k) ^ 2.0
	tmp = 0.0
	if (Float64(l * l) <= 5e+135)
		tmp = Float64(2.0 * Float64(Float64(cos(k) / t_1) * Float64(l / Float64(k * Float64(k / Float64(l / t))))));
	else
		tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(k / l) * Float64(k / l))) * Float64(t_1 / cos(k))));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	t_1 = sin(k) ^ 2.0;
	tmp = 0.0;
	if ((l * l) <= 5e+135)
		tmp = 2.0 * ((cos(k) / t_1) * (l / (k * (k / (l / t)))));
	else
		tmp = 2.0 / ((t * ((k / l) * (k / l))) * (t_1 / cos(k)));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 5e+135], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+135}:\\
\;\;\;\;2 \cdot \left(\frac{\cos k}{t_1} \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)\right) \cdot \frac{t_1}{\cos k}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 5.00000000000000029e135

    1. Initial program 30.5%

      \[\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. Taylor expanded in t around 0 75.3%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow288.3%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000029e135 < (*.f64 l l)

    1. Initial program 33.9%

      \[\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. Taylor expanded in t around 0 71.6%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow276.0%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 71.6%

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{{\ell}^{2}}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      6. unpow278.1%

        \[\leadsto \frac{2}{\frac{k}{\frac{\color{blue}{\ell \cdot \ell}}{k \cdot t}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      7. associate-/l*88.2%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\ell}{\frac{k \cdot t}{\ell}}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      8. associate-/r/88.2%

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

        \[\leadsto \frac{2}{\frac{k}{\frac{\ell}{\color{blue}{t \cdot k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      10. associate-/r*91.2%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\frac{\ell}{t}}{k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
    9. Simplified91.2%

      \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{\frac{\ell}{t}}{k} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}}} \]
    10. Taylor expanded in k around 0 71.6%

      \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
    11. Step-by-step derivation
      1. associate-/l*73.5%

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2}}{\frac{{\ell}^{2}}{t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      2. associate-/r/75.6%

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

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

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

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

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

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

Alternative 4: 86.4% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} \mathbf{if}\;k \leq 1.6 \cdot 10^{-136}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{{\sin k}^{2}} \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{k \cdot k}\right)\right)\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (if (<= k 1.6e-136)
   (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l))))
   (* 2.0 (* (/ (cos k) (pow (sin k) 2.0)) (* (/ l t) (/ l (* k k)))))))
k = abs(k);
double code(double t, double l, double k) {
	double tmp;
	if (k <= 1.6e-136) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = 2.0 * ((cos(k) / pow(sin(k), 2.0)) * ((l / t) * (l / (k * k))));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if (k <= 1.6d-136) then
        tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
    else
        tmp = 2.0d0 * ((cos(k) / (sin(k) ** 2.0d0)) * ((l / t) * (l / (k * k))))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double tmp;
	if (k <= 1.6e-136) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = 2.0 * ((Math.cos(k) / Math.pow(Math.sin(k), 2.0)) * ((l / t) * (l / (k * k))));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	tmp = 0
	if k <= 1.6e-136:
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)))
	else:
		tmp = 2.0 * ((math.cos(k) / math.pow(math.sin(k), 2.0)) * ((l / t) * (l / (k * k))))
	return tmp
k = abs(k)
function code(t, l, k)
	tmp = 0.0
	if (k <= 1.6e-136)
		tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l))));
	else
		tmp = Float64(2.0 * Float64(Float64(cos(k) / (sin(k) ^ 2.0)) * Float64(Float64(l / t) * Float64(l / Float64(k * k)))));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	tmp = 0.0;
	if (k <= 1.6e-136)
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	else
		tmp = 2.0 * ((cos(k) / (sin(k) ^ 2.0)) * ((l / t) * (l / (k * k))));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := If[LessEqual[k, 1.6e-136], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.6 \cdot 10^{-136}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 1.59999999999999996e-136

    1. Initial program 30.3%

      \[\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. Taylor expanded in t around 0 73.4%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow287.2%

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\frac{{k}^{2}}{\ell}}} \]
    8. Step-by-step derivation
      1. unpow275.7%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \frac{\color{blue}{k \cdot k}}{\ell}} \]
      2. associate-*l/78.2%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left(\frac{k}{\ell} \cdot k\right)}} \]
      3. *-commutative78.2%

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

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

    if 1.59999999999999996e-136 < k

    1. Initial program 33.9%

      \[\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*33.9%

        \[\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. *-commutative33.9%

        \[\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-/r*34.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{2}{\frac{\sin k}{\frac{\ell}{\frac{{t}^{3}}{\ell}}} \cdot \tan k}}{\color{blue}{\frac{-k}{t} \cdot \frac{-k}{t}}} \]
      16. distribute-frac-neg50.7%

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

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

      \[\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. associate-*r*74.7%

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

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

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

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

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

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

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

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

Alternative 5: 90.8% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} \mathbf{if}\;k \leq 6.2 \cdot 10^{-137}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\frac{\cos k}{{\sin k}^{2}} \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (if (<= k 6.2e-137)
   (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l))))
   (* 2.0 (* (/ (cos k) (pow (sin k) 2.0)) (/ l (* k (/ k (/ l t))))))))
k = abs(k);
double code(double t, double l, double k) {
	double tmp;
	if (k <= 6.2e-137) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = 2.0 * ((cos(k) / pow(sin(k), 2.0)) * (l / (k * (k / (l / t)))));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if (k <= 6.2d-137) then
        tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
    else
        tmp = 2.0d0 * ((cos(k) / (sin(k) ** 2.0d0)) * (l / (k * (k / (l / t)))))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double tmp;
	if (k <= 6.2e-137) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = 2.0 * ((Math.cos(k) / Math.pow(Math.sin(k), 2.0)) * (l / (k * (k / (l / t)))));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	tmp = 0
	if k <= 6.2e-137:
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)))
	else:
		tmp = 2.0 * ((math.cos(k) / math.pow(math.sin(k), 2.0)) * (l / (k * (k / (l / t)))))
	return tmp
k = abs(k)
function code(t, l, k)
	tmp = 0.0
	if (k <= 6.2e-137)
		tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l))));
	else
		tmp = Float64(2.0 * Float64(Float64(cos(k) / (sin(k) ^ 2.0)) * Float64(l / Float64(k * Float64(k / Float64(l / t))))));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	tmp = 0.0;
	if (k <= 6.2e-137)
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	else
		tmp = 2.0 * ((cos(k) / (sin(k) ^ 2.0)) * (l / (k * (k / (l / t)))));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := If[LessEqual[k, 6.2e-137], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.2 \cdot 10^{-137}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 6.19999999999999955e-137

    1. Initial program 30.3%

      \[\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. Taylor expanded in t around 0 73.4%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow287.2%

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\frac{{k}^{2}}{\ell}}} \]
    8. Step-by-step derivation
      1. unpow275.7%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \frac{\color{blue}{k \cdot k}}{\ell}} \]
      2. associate-*l/78.2%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left(\frac{k}{\ell} \cdot k\right)}} \]
      3. *-commutative78.2%

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

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

    if 6.19999999999999955e-137 < k

    1. Initial program 33.9%

      \[\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. Taylor expanded in t around 0 74.7%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow278.8%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 90.2% accurate, 1.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} t_1 := \frac{\cos k}{{\sin k}^{2}}\\ \mathbf{if}\;t \leq 1.65 \cdot 10^{-200}:\\ \;\;\;\;\left(\frac{2}{k} \cdot \left(\ell \cdot \frac{\frac{\ell}{k}}{t}\right)\right) \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t_1 \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (let* ((t_1 (/ (cos k) (pow (sin k) 2.0))))
   (if (<= t 1.65e-200)
     (* (* (/ 2.0 k) (* l (/ (/ l k) t))) t_1)
     (* 2.0 (* t_1 (/ l (* k (/ k (/ l t)))))))))
k = abs(k);
double code(double t, double l, double k) {
	double t_1 = cos(k) / pow(sin(k), 2.0);
	double tmp;
	if (t <= 1.65e-200) {
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1;
	} else {
		tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_1
    real(8) :: tmp
    t_1 = cos(k) / (sin(k) ** 2.0d0)
    if (t <= 1.65d-200) then
        tmp = ((2.0d0 / k) * (l * ((l / k) / t))) * t_1
    else
        tmp = 2.0d0 * (t_1 * (l / (k * (k / (l / t)))))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double t_1 = Math.cos(k) / Math.pow(Math.sin(k), 2.0);
	double tmp;
	if (t <= 1.65e-200) {
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1;
	} else {
		tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	t_1 = math.cos(k) / math.pow(math.sin(k), 2.0)
	tmp = 0
	if t <= 1.65e-200:
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1
	else:
		tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))))
	return tmp
k = abs(k)
function code(t, l, k)
	t_1 = Float64(cos(k) / (sin(k) ^ 2.0))
	tmp = 0.0
	if (t <= 1.65e-200)
		tmp = Float64(Float64(Float64(2.0 / k) * Float64(l * Float64(Float64(l / k) / t))) * t_1);
	else
		tmp = Float64(2.0 * Float64(t_1 * Float64(l / Float64(k * Float64(k / Float64(l / t))))));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	t_1 = cos(k) / (sin(k) ^ 2.0);
	tmp = 0.0;
	if (t <= 1.65e-200)
		tmp = ((2.0 / k) * (l * ((l / k) / t))) * t_1;
	else
		tmp = 2.0 * (t_1 * (l / (k * (k / (l / t)))));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.65e-200], N[(N[(N[(2.0 / k), $MachinePrecision] * N[(l * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(l / N[(k * N[(k / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\cos k}{{\sin k}^{2}}\\
\mathbf{if}\;t \leq 1.65 \cdot 10^{-200}:\\
\;\;\;\;\left(\frac{2}{k} \cdot \left(\ell \cdot \frac{\frac{\ell}{k}}{t}\right)\right) \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{\ell}{k \cdot \frac{k}{\frac{\ell}{t}}}\right)\\


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

    1. Initial program 32.9%

      \[\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. Taylor expanded in t around 0 74.8%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow283.5%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 74.8%

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{{\ell}^{2}}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      6. unpow282.0%

        \[\leadsto \frac{2}{\frac{k}{\frac{\color{blue}{\ell \cdot \ell}}{k \cdot t}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      7. associate-/l*90.6%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\ell}{\frac{k \cdot t}{\ell}}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      8. associate-/r/90.6%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\ell}{k \cdot t} \cdot \ell}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      9. *-commutative90.6%

        \[\leadsto \frac{2}{\frac{k}{\frac{\ell}{\color{blue}{t \cdot k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      10. associate-/r*91.6%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\frac{\frac{\ell}{t}}{k}} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
    9. Simplified91.6%

      \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{\frac{\ell}{t}}{k} \cdot \ell} \cdot \frac{{\sin k}^{2}}{\cos k}}} \]
    10. Taylor expanded in k around inf 75.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{k}{\frac{{\ell}^{2}}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      8. unpow282.0%

        \[\leadsto \frac{2}{\frac{k}{\frac{\color{blue}{\ell \cdot \ell}}{k \cdot t}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      9. associate-*r/90.6%

        \[\leadsto \frac{2}{\frac{k}{\color{blue}{\ell \cdot \frac{\ell}{k \cdot t}}} \cdot \frac{{\sin k}^{2}}{\cos k}} \]
      10. associate-*r/90.6%

        \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}} \cdot {\sin k}^{2}}{\cos k}}} \]
      11. associate-/l*90.6%

        \[\leadsto \frac{2}{\color{blue}{\frac{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}}}{\frac{\cos k}{{\sin k}^{2}}}}} \]
      12. associate-/r/90.6%

        \[\leadsto \color{blue}{\frac{2}{\frac{k}{\ell \cdot \frac{\ell}{k \cdot t}}} \cdot \frac{\cos k}{{\sin k}^{2}}} \]
    12. Simplified94.6%

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

    if 1.6499999999999999e-200 < t

    1. Initial program 29.6%

      \[\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. Taylor expanded in t around 0 72.1%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow284.3%

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left({\sin k}^{2} \cdot \frac{1}{\ell \cdot \cos k}\right)}} \]
    7. Taylor expanded in k around inf 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 72.9% accurate, 24.7× speedup?

\[\begin{array}{l} k = |k|\\ \\ \begin{array}{l} \mathbf{if}\;k \leq 2.45 \cdot 10^{+67}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)\\ \end{array} \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (if (<= k 2.45e+67)
   (/ 2.0 (* (/ (* k (* k t)) l) (* k (/ k l))))
   (* -0.3333333333333333 (* (/ l k) (/ (/ l k) t)))))
k = abs(k);
double code(double t, double l, double k) {
	double tmp;
	if (k <= 2.45e+67) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
	}
	return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if (k <= 2.45d+67) then
        tmp = 2.0d0 / (((k * (k * t)) / l) * (k * (k / l)))
    else
        tmp = (-0.3333333333333333d0) * ((l / k) * ((l / k) / t))
    end if
    code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	double tmp;
	if (k <= 2.45e+67) {
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	} else {
		tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
	}
	return tmp;
}
k = abs(k)
def code(t, l, k):
	tmp = 0
	if k <= 2.45e+67:
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)))
	else:
		tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t))
	return tmp
k = abs(k)
function code(t, l, k)
	tmp = 0.0
	if (k <= 2.45e+67)
		tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(k * t)) / l) * Float64(k * Float64(k / l))));
	else
		tmp = Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / k) / t)));
	end
	return tmp
end
k = abs(k)
function tmp_2 = code(t, l, k)
	tmp = 0.0;
	if (k <= 2.45e+67)
		tmp = 2.0 / (((k * (k * t)) / l) * (k * (k / l)));
	else
		tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
	end
	tmp_2 = tmp;
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := If[LessEqual[k, 2.45e+67], N[(2.0 / N[(N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{+67}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\

\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)\\


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

    1. Initial program 30.9%

      \[\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. Taylor expanded in t around 0 75.1%

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{2} \cdot t}{\ell} \cdot \frac{{\sin k}^{2}}{\ell \cdot \cos k}}} \]
      5. unpow287.2%

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\frac{{k}^{2}}{\ell}}} \]
    8. Step-by-step derivation
      1. unpow275.1%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \frac{\color{blue}{k \cdot k}}{\ell}} \]
      2. associate-*l/77.1%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \color{blue}{\left(\frac{k}{\ell} \cdot k\right)}} \]
      3. *-commutative77.1%

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

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

    if 2.44999999999999995e67 < k

    1. Initial program 34.9%

      \[\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*34.9%

        \[\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. *-commutative34.9%

        \[\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-/r*34.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} + -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
      2. fma-def59.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, \frac{{\ell}^{2}}{{k}^{4} \cdot t}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right)} \]
      3. unpow259.2%

        \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
      4. *-commutative59.2%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{\color{blue}{t \cdot {k}^{4}}}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
      5. times-frac58.8%

        \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
      6. associate-*r/58.8%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \color{blue}{\frac{-0.3333333333333333 \cdot {\ell}^{2}}{{k}^{2} \cdot t}}\right) \]
      7. *-commutative58.8%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333 \cdot {\ell}^{2}}{\color{blue}{t \cdot {k}^{2}}}\right) \]
      8. times-frac58.8%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \color{blue}{\frac{-0.3333333333333333}{t} \cdot \frac{{\ell}^{2}}{{k}^{2}}}\right) \]
      9. unpow258.8%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2}}\right) \]
      10. unpow258.8%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot k}}\right) \]
      11. times-frac62.1%

        \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}\right) \]
    6. Simplified62.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\right)} \]
    7. Taylor expanded in k around inf 62.7%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
    8. Step-by-step derivation
      1. unpow262.7%

        \[\leadsto -0.3333333333333333 \cdot \frac{{\ell}^{2}}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
      2. associate-*r*63.5%

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

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

        \[\leadsto \frac{-0.3333333333333333 \cdot \color{blue}{\left(\ell \cdot \ell\right)}}{k \cdot \left(k \cdot t\right)} \]
    9. Simplified63.5%

      \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \left(\ell \cdot \ell\right)}{k \cdot \left(k \cdot t\right)}} \]
    10. Taylor expanded in l around 0 62.7%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
    11. Step-by-step derivation
      1. unpow262.7%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2} \cdot t} \]
      2. unpow262.7%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
      3. associate-*r*63.5%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot \left(k \cdot t\right)}} \]
      4. associate-/l*65.5%

        \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{\ell}{\frac{k \cdot \left(k \cdot t\right)}{\ell}}} \]
      5. associate-*l/66.2%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\frac{k}{\ell} \cdot \left(k \cdot t\right)}} \]
      6. *-commutative66.2%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\frac{k}{\ell} \cdot \color{blue}{\left(t \cdot k\right)}} \]
      7. associate-*r*66.6%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\left(\frac{k}{\ell} \cdot t\right) \cdot k}} \]
      8. associate-/r/65.8%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\frac{k}{\frac{\ell}{t}}} \cdot k} \]
    12. Simplified65.8%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{\ell}{\frac{k}{\frac{\ell}{t}} \cdot k}} \]
    13. Taylor expanded in l around 0 62.7%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
    14. Step-by-step derivation
      1. unpow262.7%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2} \cdot t} \]
      2. unpow262.7%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
      3. associate-*r*63.5%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot \left(k \cdot t\right)}} \]
      4. *-commutative63.5%

        \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot t\right) \cdot k}} \]
      5. times-frac66.3%

        \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\frac{\ell}{k \cdot t} \cdot \frac{\ell}{k}\right)} \]
      6. associate-/r*66.9%

        \[\leadsto -0.3333333333333333 \cdot \left(\color{blue}{\frac{\frac{\ell}{k}}{t}} \cdot \frac{\ell}{k}\right) \]
    15. Simplified66.9%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\frac{\frac{\ell}{k}}{t} \cdot \frac{\ell}{k}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 2.45 \cdot 10^{+67}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\ell} \cdot \left(k \cdot \frac{k}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)\\ \end{array} \]

Alternative 8: 34.6% accurate, 38.3× speedup?

\[\begin{array}{l} k = |k|\\ \\ -0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right) \end{array} \]
NOTE: k should be positive before calling this function
(FPCore (t l k)
 :precision binary64
 (* -0.3333333333333333 (* (/ l k) (/ (/ l k) t))))
k = abs(k);
double code(double t, double l, double k) {
	return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = (-0.3333333333333333d0) * ((l / k) * ((l / k) / t))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
	return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
k = abs(k)
def code(t, l, k):
	return -0.3333333333333333 * ((l / k) * ((l / k) / t))
k = abs(k)
function code(t, l, k)
	return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / k) / t)))
end
k = abs(k)
function tmp = code(t, l, k)
	tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t));
end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)
\end{array}
Derivation
  1. Initial program 31.8%

    \[\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*31.9%

      \[\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. *-commutative31.9%

      \[\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-/r*36.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} + -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
    2. fma-def34.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \frac{{\ell}^{2}}{{k}^{4} \cdot t}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right)} \]
    3. unpow234.1%

      \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
    4. *-commutative34.1%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell \cdot \ell}{\color{blue}{t \cdot {k}^{4}}}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
    5. times-frac34.0%

      \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}}, -0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \]
    6. associate-*r/34.0%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \color{blue}{\frac{-0.3333333333333333 \cdot {\ell}^{2}}{{k}^{2} \cdot t}}\right) \]
    7. *-commutative34.0%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333 \cdot {\ell}^{2}}{\color{blue}{t \cdot {k}^{2}}}\right) \]
    8. times-frac34.9%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \color{blue}{\frac{-0.3333333333333333}{t} \cdot \frac{{\ell}^{2}}{{k}^{2}}}\right) \]
    9. unpow234.9%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2}}\right) \]
    10. unpow234.9%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot k}}\right) \]
    11. times-frac41.7%

      \[\leadsto \mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}\right) \]
  6. Simplified41.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(2, \frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}, \frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\right)} \]
  7. Taylor expanded in k around inf 29.2%

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
  8. Step-by-step derivation
    1. unpow229.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{{\ell}^{2}}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
    2. associate-*r*29.9%

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

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

      \[\leadsto \frac{-0.3333333333333333 \cdot \color{blue}{\left(\ell \cdot \ell\right)}}{k \cdot \left(k \cdot t\right)} \]
  9. Simplified29.9%

    \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \left(\ell \cdot \ell\right)}{k \cdot \left(k \cdot t\right)}} \]
  10. Taylor expanded in l around 0 29.2%

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
  11. Step-by-step derivation
    1. unpow229.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2} \cdot t} \]
    2. unpow229.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
    3. associate-*r*29.9%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot \left(k \cdot t\right)}} \]
    4. associate-/l*30.5%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{\ell}{\frac{k \cdot \left(k \cdot t\right)}{\ell}}} \]
    5. associate-*l/30.8%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\frac{k}{\ell} \cdot \left(k \cdot t\right)}} \]
    6. *-commutative30.8%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\frac{k}{\ell} \cdot \color{blue}{\left(t \cdot k\right)}} \]
    7. associate-*r*30.9%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\left(\frac{k}{\ell} \cdot t\right) \cdot k}} \]
    8. associate-/r/30.7%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell}{\color{blue}{\frac{k}{\frac{\ell}{t}}} \cdot k} \]
  12. Simplified30.7%

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{\ell}{\frac{k}{\frac{\ell}{t}} \cdot k}} \]
  13. Taylor expanded in l around 0 29.2%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
  14. Step-by-step derivation
    1. unpow229.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\ell \cdot \ell}}{{k}^{2} \cdot t} \]
    2. unpow229.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot t} \]
    3. associate-*r*29.9%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot \left(k \cdot t\right)}} \]
    4. *-commutative29.9%

      \[\leadsto -0.3333333333333333 \cdot \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot t\right) \cdot k}} \]
    5. times-frac30.8%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\frac{\ell}{k \cdot t} \cdot \frac{\ell}{k}\right)} \]
    6. associate-/r*31.0%

      \[\leadsto -0.3333333333333333 \cdot \left(\color{blue}{\frac{\frac{\ell}{k}}{t}} \cdot \frac{\ell}{k}\right) \]
  15. Simplified31.0%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\frac{\frac{\ell}{k}}{t} \cdot \frac{\ell}{k}\right)} \]
  16. Final simplification31.0%

    \[\leadsto -0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right) \]

Reproduce

?
herbie shell --seed 2023283 
(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))))