Toniolo and Linder, Equation (10-)

Percentage Accurate: 34.6% → 94.5%
Time: 22.3s
Alternatives: 13
Speedup: 3.8×

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 13 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.6% 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: 94.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt22.3%

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}} \cdot \frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}}} \]
    7. Step-by-step derivation
      1. unpow219.7%

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

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

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

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

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

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

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

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

    if 8.7e12 < k

    1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.0% accurate, 1.0× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;k_m \leq 2.65 \cdot 10^{-30}:\\
\;\;\;\;{\left(\frac{\ell}{\frac{{k_m}^{2}}{\sqrt{2}}} \cdot \sqrt{\frac{1}{t_m}}\right)}^{2}\\

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


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

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt22.2%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{{k}^{2}} \cdot \sqrt{\frac{1}{t}}\right)}}^{2} \]
    10. Step-by-step derivation
      1. associate-/l*26.6%

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

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

    if 2.64999999999999987e-30 < k

    1. Initial program 35.7%

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

        \[\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. *-commutative35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. times-frac52.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 2.65 \cdot 10^{-30}:\\ \;\;\;\;{\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot \sqrt{\frac{1}{t}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\ell \cdot \frac{1}{k}\right)}^{2} \cdot \frac{\frac{\cos k}{t}}{{\sin k}^{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 81.4% accurate, 1.0× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;k_m \leq 7.2 \cdot 10^{-31}:\\
\;\;\;\;{\left(\frac{\ell}{\frac{{k_m}^{2}}{\sqrt{2}}} \cdot \sqrt{\frac{1}{t_m}}\right)}^{2}\\

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


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

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt22.2%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{{k}^{2}} \cdot \sqrt{\frac{1}{t}}\right)}}^{2} \]
    10. Step-by-step derivation
      1. associate-/l*26.6%

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

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

    if 7.20000000000000007e-31 < k

    1. Initial program 35.7%

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

        \[\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. *-commutative35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. times-frac52.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 7.2 \cdot 10^{-31}:\\ \;\;\;\;{\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot \sqrt{\frac{1}{t}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k}{t} \cdot {\ell}^{2}}{{\left(k \cdot \sin k\right)}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 71.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-sqr-sqrt28.2%

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}} \cdot \frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}}} \]
  7. Step-by-step derivation
    1. unpow218.8%

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\ell \cdot \sqrt{2}}{{k}^{2}} \cdot \sqrt{\frac{1}{t}}\right)\right)\right)}}^{2} \]
    2. expm1-udef18.3%

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

      \[\leadsto {\left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}}} \cdot \sqrt{\frac{1}{t}}\right)} - 1\right)}^{2} \]
    4. pow1/218.3%

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

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

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

      \[\leadsto {\left(e^{\mathsf{log1p}\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot {t}^{\color{blue}{-0.5}}\right)} - 1\right)}^{2} \]
  11. Applied egg-rr18.3%

    \[\leadsto {\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot {t}^{-0.5}\right)} - 1\right)}}^{2} \]
  12. Step-by-step derivation
    1. expm1-def19.3%

      \[\leadsto {\color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\ell}{\frac{{k}^{2}}{\sqrt{2}}} \cdot {t}^{-0.5}\right)\right)\right)}}^{2} \]
    2. expm1-log1p27.3%

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

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

    \[\leadsto {\color{blue}{\left(\left(\frac{\ell}{{k}^{2}} \cdot \sqrt{2}\right) \cdot {t}^{-0.5}\right)}}^{2} \]
  14. Final simplification27.3%

    \[\leadsto {\left({t}^{-0.5} \cdot \left(\sqrt{2} \cdot \frac{\ell}{{k}^{2}}\right)\right)}^{2} \]
  15. Add Preprocessing

Alternative 5: 71.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-sqr-sqrt28.2%

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}} \cdot \frac{\frac{\sqrt{\frac{2}{\sin k}}}{\frac{{t}^{1.5} \cdot \sqrt{\tan k}}{\ell}}}{\frac{k}{t}}} \]
  7. Step-by-step derivation
    1. unpow218.8%

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

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

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

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

    \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{{k}^{2}} \cdot \sqrt{\frac{1}{t}}\right)}}^{2} \]
  10. Step-by-step derivation
    1. associate-*l/27.3%

      \[\leadsto {\color{blue}{\left(\frac{\left(\ell \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{t}}}{{k}^{2}}\right)}}^{2} \]
    2. pow1/227.3%

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

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

      \[\leadsto {\left(\frac{\left(\ell \cdot \sqrt{2}\right) \cdot \color{blue}{{t}^{\left(-1 \cdot 0.5\right)}}}{{k}^{2}}\right)}^{2} \]
    5. metadata-eval27.3%

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

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

    \[\leadsto {\left(\frac{\left(\ell \cdot \sqrt{2}\right) \cdot {t}^{-0.5}}{{k}^{2}}\right)}^{2} \]
  13. Add Preprocessing

Alternative 6: 67.8% accurate, 1.3× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 8 \cdot 10^{-78}:\\
\;\;\;\;\frac{2}{\frac{{k_m}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t_m}}\right)}^{2}}}\\

\mathbf{elif}\;t_m \leq 1.12 \cdot 10^{+101}:\\
\;\;\;\;\frac{2}{\frac{\sin k_m \cdot {t_m}^{3}}{\ell \cdot \ell} \cdot \left(\tan k_m \cdot \frac{k_m}{t_m \cdot \frac{t_m}{k_m}}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 7.99999999999999999e-78

    1. Initial program 38.0%

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{4}}{\frac{{\ell}^{2}}{t}}}} \]
    7. Simplified63.8%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    9. Applied egg-rr63.8%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{{\ell}^{2}}}{t}}} \]
      2. add-sqr-sqrt25.6%

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\color{blue}{\sqrt{\frac{{\ell}^{2}}{t}} \cdot \sqrt{\frac{{\ell}^{2}}{t}}}}} \]
      3. pow225.6%

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

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

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

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

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

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

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

    if 7.99999999999999999e-78 < t < 1.1199999999999999e101

    1. Initial program 68.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{2}{\frac{{t}^{3} \cdot \sin k}{\ell \cdot \ell} \cdot \left(\tan k \cdot \left(1 + \left({\left(\frac{k}{t}\right)}^{2} - 1\right)\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-+r-77.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{t}^{3} \cdot \sin k}{\ell \cdot \ell} \cdot \left(\tan k \cdot \color{blue}{\frac{1 \cdot k}{\frac{t}{k} \cdot t}}\right)} \]
      9. *-un-lft-identity82.0%

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

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

    if 1.1199999999999999e101 < t

    1. Initial program 18.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*18.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. *-commutative18.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-*l*18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{2}{\sin k \cdot \color{blue}{\frac{\frac{\tan k}{\ell} \cdot {t}^{3}}{\ell}}}}{{\left(\frac{k}{t}\right)}^{2}} \]
    9. 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)}} \]
    10. Step-by-step derivation
      1. times-frac78.7%

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

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

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

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

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{t}}\right)\right) \]
      2. metadata-eval69.5%

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{\color{blue}{0.16666666666666666}}{t}\right)\right) \]
    14. Simplified69.5%

      \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \color{blue}{\left(\frac{1}{{k}^{2} \cdot t} - \frac{0.16666666666666666}{t}\right)}\right) \]
    15. Step-by-step derivation
      1. associate-*l/69.5%

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

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

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \left(\frac{{k}^{\color{blue}{-2}}}{t} - \frac{0.16666666666666666}{t}\right)}{{k}^{2}} \]
    16. Applied egg-rr69.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 8 \cdot 10^{-78}:\\ \;\;\;\;\frac{2}{\frac{{k}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t}}\right)}^{2}}}\\ \mathbf{elif}\;t \leq 1.12 \cdot 10^{+101}:\\ \;\;\;\;\frac{2}{\frac{\sin k \cdot {t}^{3}}{\ell \cdot \ell} \cdot \left(\tan k \cdot \frac{k}{t \cdot \frac{t}{k}}\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{{\ell}^{2} \cdot \left(\frac{{k}^{-2}}{t} - \frac{0.16666666666666666}{t}\right)}{{k}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.3% accurate, 1.3× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 0 \lor \neg \left(\ell \cdot \ell \leq 5 \cdot 10^{+158}\right):\\
\;\;\;\;\frac{2}{\frac{{k_m}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t_m}}\right)}^{2}}}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell \cdot \ell}{{k_m}^{2}} \cdot \left(\frac{1}{t_m \cdot {k_m}^{2}} - \frac{0.16666666666666666}{t_m}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 0.0 or 4.9999999999999996e158 < (*.f64 l l)

    1. Initial program 32.7%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    9. Applied egg-rr60.2%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{{\ell}^{2}}}{t}}} \]
      2. add-sqr-sqrt34.7%

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\color{blue}{\sqrt{\frac{{\ell}^{2}}{t}} \cdot \sqrt{\frac{{\ell}^{2}}{t}}}}} \]
      3. pow234.7%

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

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

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

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

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

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

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

    if 0.0 < (*.f64 l l) < 4.9999999999999996e158

    1. Initial program 46.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. Step-by-step derivation
      1. associate-/r*45.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. *-commutative45.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-*l*45.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{t}}\right)\right) \]
      2. metadata-eval79.5%

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{\color{blue}{0.16666666666666666}}{t}\right)\right) \]
    14. Simplified79.5%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    16. Applied egg-rr79.5%

      \[\leadsto 2 \cdot \left(\frac{\color{blue}{\ell \cdot \ell}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{0.16666666666666666}{t}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 0 \lor \neg \left(\ell \cdot \ell \leq 5 \cdot 10^{+158}\right):\\ \;\;\;\;\frac{2}{\frac{{k}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t}}\right)}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\frac{\ell \cdot \ell}{{k}^{2}} \cdot \left(\frac{1}{t \cdot {k}^{2}} - \frac{0.16666666666666666}{t}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.6% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 29.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. Step-by-step derivation
      1. associate-*l*29.3%

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\frac{{k}^{4}}{\frac{{\ell}^{2}}{t}}}} \]
    7. Simplified67.5%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    9. Applied egg-rr67.5%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{{\ell}^{2}}}{t}}} \]
      2. add-sqr-sqrt67.5%

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\color{blue}{\sqrt{\frac{{\ell}^{2}}{t}} \cdot \sqrt{\frac{{\ell}^{2}}{t}}}}} \]
      3. pow267.5%

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

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

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

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

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

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

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

    if 0.0 < (*.f64 l l)

    1. Initial program 40.7%

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

        \[\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. *-commutative40.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 0:\\ \;\;\;\;\frac{2}{\frac{{k}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t}}\right)}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{1}{t \cdot {k}^{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 65.4% accurate, 1.3× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.55 \cdot 10^{-45}:\\
\;\;\;\;\frac{2}{\frac{{k_m}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t_m}}\right)}^{2}}}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{{\ell}^{2}}{t_m \cdot {k_m}^{2}} \cdot \left({k_m}^{-2} + -0.16666666666666666\right)\right)\\


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

    1. Initial program 38.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    9. Applied egg-rr63.7%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{{\ell}^{2}}}{t}}} \]
      2. add-sqr-sqrt25.9%

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

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

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

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

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

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

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

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

    if 1.55e-45 < t

    1. Initial program 37.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*38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \color{blue}{\left(\frac{1}{{k}^{2} \cdot t} - \frac{0.16666666666666666}{t}\right)}\right) \]
    15. Taylor expanded in l around 0 73.3%

      \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \left(\frac{1}{{k}^{2} \cdot t} - 0.16666666666666666 \cdot \frac{1}{t}\right)}{{k}^{2}}} \]
    16. Step-by-step derivation
      1. associate-/l*71.3%

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{\frac{{k}^{2}}{\frac{1}{{k}^{2} \cdot t} - 0.16666666666666666 \cdot \frac{1}{t}}}} \]
      2. associate-/r*71.3%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\frac{{k}^{2}}{\color{blue}{\frac{\frac{1}{{k}^{2}}}{t}} - 0.16666666666666666 \cdot \frac{1}{t}}} \]
      3. associate-*r/71.3%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\frac{{k}^{2}}{\frac{\frac{1}{{k}^{2}}}{t} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{t}}}} \]
      4. metadata-eval71.3%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\frac{{k}^{2}}{\frac{\frac{1}{{k}^{2}}}{t} - \frac{\color{blue}{0.16666666666666666}}{t}}} \]
      5. div-sub71.3%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\frac{{k}^{2}}{\color{blue}{\frac{\frac{1}{{k}^{2}} - 0.16666666666666666}{t}}}} \]
      6. associate-/l*71.4%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{\frac{{k}^{2} \cdot t}{\frac{1}{{k}^{2}} - 0.16666666666666666}}} \]
      7. *-commutative71.4%

        \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\frac{\color{blue}{t \cdot {k}^{2}}}{\frac{1}{{k}^{2}} - 0.16666666666666666}} \]
      8. associate-/r/73.1%

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

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot t}} \cdot \left(\frac{1}{{k}^{2}} - 0.16666666666666666\right)\right) \]
      10. sub-neg73.1%

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2} \cdot t} \cdot \color{blue}{\left(\frac{1}{{k}^{2}} + \left(-0.16666666666666666\right)\right)}\right) \]
    17. Simplified73.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.55 \cdot 10^{-45}:\\ \;\;\;\;\frac{2}{\frac{{k}^{4}}{{\left(\ell \cdot \sqrt{\frac{1}{t}}\right)}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\frac{{\ell}^{2}}{t \cdot {k}^{2}} \cdot \left({k}^{-2} + -0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 63.9% accurate, 1.3× speedup?

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 8.5 \cdot 10^{+79}:\\
\;\;\;\;2 \cdot \left(\frac{\ell \cdot \ell}{{k_m}^{2}} \cdot \left(\frac{1}{t_m \cdot {k_m}^{2}} - \frac{0.16666666666666666}{t_m}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\cos k_m \cdot {\ell}^{2}}{t_m \cdot {k_m}^{4}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 8.4999999999999998e79

    1. Initial program 36.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*36.3%

        \[\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. *-commutative36.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. times-frac53.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{t}}\right)\right) \]
      2. metadata-eval69.6%

        \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{\color{blue}{0.16666666666666666}}{t}\right)\right) \]
    14. Simplified69.6%

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

        \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
    16. Applied egg-rr69.6%

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

    if 8.4999999999999998e79 < l

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

        \[\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. *-commutative43.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 8.5 \cdot 10^{+79}:\\ \;\;\;\;2 \cdot \left(\frac{\ell \cdot \ell}{{k}^{2}} \cdot \left(\frac{1}{t \cdot {k}^{2}} - \frac{0.16666666666666666}{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\cos k \cdot {\ell}^{2}}{t \cdot {k}^{4}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 63.7% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{{t}^{3} \cdot \tan k}{\ell \cdot \ell}}}{{\left(\frac{k}{t}\right)}^{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. times-frac51.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \color{blue}{\frac{0.16666666666666666 \cdot 1}{t}}\right)\right) \]
    2. metadata-eval66.8%

      \[\leadsto 2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{\color{blue}{0.16666666666666666}}{t}\right)\right) \]
  14. Simplified66.8%

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

      \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
  16. Applied egg-rr66.8%

    \[\leadsto 2 \cdot \left(\frac{\color{blue}{\ell \cdot \ell}}{{k}^{2}} \cdot \left(\frac{1}{{k}^{2} \cdot t} - \frac{0.16666666666666666}{t}\right)\right) \]
  17. Final simplification66.8%

    \[\leadsto 2 \cdot \left(\frac{\ell \cdot \ell}{{k}^{2}} \cdot \left(\frac{1}{t \cdot {k}^{2}} - \frac{0.16666666666666666}{t}\right)\right) \]
  18. Add Preprocessing

Alternative 12: 59.7% accurate, 3.8× speedup?

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

\\
t_s \cdot \frac{2}{\frac{{k_m}^{4}}{\frac{\ell \cdot \ell}{t_m}}}
\end{array}
Derivation
  1. Initial program 38.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
  9. Applied egg-rr64.2%

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

    \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\ell \cdot \ell}{t}}} \]
  11. Add Preprocessing

Alternative 13: 60.7% accurate, 3.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot {\ell}^{2}}{\color{blue}{t \cdot {k}^{4}}} \]
  7. Simplified65.4%

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

      \[\leadsto \frac{2}{\frac{{k}^{4}}{\frac{\color{blue}{\ell \cdot \ell}}{t}}} \]
  9. Applied egg-rr65.4%

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

    \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{t \cdot {k}^{4}} \]
  11. Add Preprocessing

Reproduce

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