Toniolo and Linder, Equation (10-)

Percentage Accurate: 34.9% → 95.0%
Time: 31.6s
Alternatives: 12
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 12 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 95.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 3 \cdot 10^{-24}:\\ \;\;\;\;2 \cdot {\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos k_m}}\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{\cos k_m \cdot {\left(\frac{\ell}{k_m}\right)}^{2}}{{\sin k_m}^{2}}}{t_m}\\ \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 3e-24)
    (* 2.0 (pow (* (/ k_m (/ l (sin k_m))) (sqrt (/ t_m (cos k_m)))) -2.0))
    (*
     2.0
     (/ (/ (* (cos k_m) (pow (/ l k_m) 2.0)) (pow (sin k_m) 2.0)) 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 (k_m <= 3e-24) {
		tmp = 2.0 * pow(((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))), -2.0);
	} else {
		tmp = 2.0 * (((cos(k_m) * pow((l / k_m), 2.0)) / pow(sin(k_m), 2.0)) / 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 (k_m <= 3d-24) then
        tmp = 2.0d0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ** (-2.0d0))
    else
        tmp = 2.0d0 * (((cos(k_m) * ((l / k_m) ** 2.0d0)) / (sin(k_m) ** 2.0d0)) / 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 (k_m <= 3e-24) {
		tmp = 2.0 * Math.pow(((k_m / (l / Math.sin(k_m))) * Math.sqrt((t_m / Math.cos(k_m)))), -2.0);
	} else {
		tmp = 2.0 * (((Math.cos(k_m) * Math.pow((l / k_m), 2.0)) / Math.pow(Math.sin(k_m), 2.0)) / 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 k_m <= 3e-24:
		tmp = 2.0 * math.pow(((k_m / (l / math.sin(k_m))) * math.sqrt((t_m / math.cos(k_m)))), -2.0)
	else:
		tmp = 2.0 * (((math.cos(k_m) * math.pow((l / k_m), 2.0)) / math.pow(math.sin(k_m), 2.0)) / 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 (k_m <= 3e-24)
		tmp = Float64(2.0 * (Float64(Float64(k_m / Float64(l / sin(k_m))) * sqrt(Float64(t_m / cos(k_m)))) ^ -2.0));
	else
		tmp = Float64(2.0 * Float64(Float64(Float64(cos(k_m) * (Float64(l / k_m) ^ 2.0)) / (sin(k_m) ^ 2.0)) / 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 (k_m <= 3e-24)
		tmp = 2.0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ^ -2.0);
	else
		tmp = 2.0 * (((cos(k_m) * ((l / k_m) ^ 2.0)) / (sin(k_m) ^ 2.0)) / 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[LessEqual[k$95$m, 3e-24], N[(2.0 * N[Power[N[(N[(k$95$m / N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / t$95$m), $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 3 \cdot 10^{-24}:\\
\;\;\;\;2 \cdot {\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos k_m}}\right)}^{-2}\\

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


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

    1. Initial program 34.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*34.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999995e-24 < k

    1. Initial program 31.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-*l*31.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 76.9% 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}\;\ell \cdot \ell \leq 2 \cdot 10^{+175}:\\ \;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{{\left(\frac{\frac{\ell}{k_m} \cdot \sqrt{\cos k_m}}{\sin k_m}\right)}^{2}}{t_m}\\ \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) 2e+175)
    (/ 2.0 (pow (* (/ (pow k_m 2.0) l) (sqrt t_m)) 2.0))
    (* 2.0 (/ (pow (/ (* (/ l k_m) (sqrt (cos k_m))) (sin k_m)) 2.0) 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) <= 2e+175) {
		tmp = 2.0 / pow(((pow(k_m, 2.0) / l) * sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * (pow((((l / k_m) * sqrt(cos(k_m))) / sin(k_m)), 2.0) / 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) <= 2d+175) then
        tmp = 2.0d0 / ((((k_m ** 2.0d0) / l) * sqrt(t_m)) ** 2.0d0)
    else
        tmp = 2.0d0 * (((((l / k_m) * sqrt(cos(k_m))) / sin(k_m)) ** 2.0d0) / 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) <= 2e+175) {
		tmp = 2.0 / Math.pow(((Math.pow(k_m, 2.0) / l) * Math.sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * (Math.pow((((l / k_m) * Math.sqrt(Math.cos(k_m))) / Math.sin(k_m)), 2.0) / 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) <= 2e+175:
		tmp = 2.0 / math.pow(((math.pow(k_m, 2.0) / l) * math.sqrt(t_m)), 2.0)
	else:
		tmp = 2.0 * (math.pow((((l / k_m) * math.sqrt(math.cos(k_m))) / math.sin(k_m)), 2.0) / 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) <= 2e+175)
		tmp = Float64(2.0 / (Float64(Float64((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0));
	else
		tmp = Float64(2.0 * Float64((Float64(Float64(Float64(l / k_m) * sqrt(cos(k_m))) / sin(k_m)) ^ 2.0) / 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) <= 2e+175)
		tmp = 2.0 / ((((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0);
	else
		tmp = 2.0 * (((((l / k_m) * sqrt(cos(k_m))) / sin(k_m)) ^ 2.0) / 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[LessEqual[N[(l * l), $MachinePrecision], 2e+175], N[(2.0 / N[Power[N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[N[(N[(N[(l / k$95$m), $MachinePrecision] * N[Sqrt[N[Cos[k$95$m], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$m), $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 2 \cdot 10^{+175}:\\
\;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e175 < (*.f64 l l)

    1. Initial program 28.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*28.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-/r*28.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 78.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}\;\ell \cdot \ell \leq 5 \cdot 10^{+147}:\\ \;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot {\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos 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 (<= (* l l) 5e+147)
    (/ 2.0 (pow (* (/ (pow k_m 2.0) l) (sqrt t_m)) 2.0))
    (* 2.0 (pow (* (/ k_m (/ l (sin k_m))) (sqrt (/ t_m (cos 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) <= 5e+147) {
		tmp = 2.0 / pow(((pow(k_m, 2.0) / l) * sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * pow(((k_m / (l / sin(k_m))) * sqrt((t_m / cos(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) <= 5d+147) then
        tmp = 2.0d0 / ((((k_m ** 2.0d0) / l) * sqrt(t_m)) ** 2.0d0)
    else
        tmp = 2.0d0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(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) <= 5e+147) {
		tmp = 2.0 / Math.pow(((Math.pow(k_m, 2.0) / l) * Math.sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * Math.pow(((k_m / (l / Math.sin(k_m))) * Math.sqrt((t_m / Math.cos(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) <= 5e+147:
		tmp = 2.0 / math.pow(((math.pow(k_m, 2.0) / l) * math.sqrt(t_m)), 2.0)
	else:
		tmp = 2.0 * math.pow(((k_m / (l / math.sin(k_m))) * math.sqrt((t_m / math.cos(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) <= 5e+147)
		tmp = Float64(2.0 / (Float64(Float64((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0));
	else
		tmp = Float64(2.0 * (Float64(Float64(k_m / Float64(l / sin(k_m))) * sqrt(Float64(t_m / cos(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) <= 5e+147)
		tmp = 2.0 / ((((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0);
	else
		tmp = 2.0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(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], 5e+147], N[(2.0 / N[Power[N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[(N[(k$95$m / N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]]), $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 5 \cdot 10^{+147}:\\
\;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\

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


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

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e147 < (*.f64 l l)

    1. Initial program 29.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-*l*29.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 94.9% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;k_m \leq 1.4 \cdot 10^{-24}:\\ \;\;\;\;2 \cdot {\left(\frac{k_m}{\frac{\ell}{\sin k_m}} \cdot \sqrt{\frac{t_m}{\cos k_m}}\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\left(\cos k_m \cdot {\left(\frac{\ell}{k_m}\right)}^{2}\right) \cdot {\sin k_m}^{-2}}{t_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (*
  t_s
  (if (<= k_m 1.4e-24)
    (* 2.0 (pow (* (/ k_m (/ l (sin k_m))) (sqrt (/ t_m (cos k_m)))) -2.0))
    (*
     2.0
     (/ (* (* (cos k_m) (pow (/ l k_m) 2.0)) (pow (sin k_m) -2.0)) 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 (k_m <= 1.4e-24) {
		tmp = 2.0 * pow(((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))), -2.0);
	} else {
		tmp = 2.0 * (((cos(k_m) * pow((l / k_m), 2.0)) * pow(sin(k_m), -2.0)) / 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 (k_m <= 1.4d-24) then
        tmp = 2.0d0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ** (-2.0d0))
    else
        tmp = 2.0d0 * (((cos(k_m) * ((l / k_m) ** 2.0d0)) * (sin(k_m) ** (-2.0d0))) / 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 (k_m <= 1.4e-24) {
		tmp = 2.0 * Math.pow(((k_m / (l / Math.sin(k_m))) * Math.sqrt((t_m / Math.cos(k_m)))), -2.0);
	} else {
		tmp = 2.0 * (((Math.cos(k_m) * Math.pow((l / k_m), 2.0)) * Math.pow(Math.sin(k_m), -2.0)) / 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 k_m <= 1.4e-24:
		tmp = 2.0 * math.pow(((k_m / (l / math.sin(k_m))) * math.sqrt((t_m / math.cos(k_m)))), -2.0)
	else:
		tmp = 2.0 * (((math.cos(k_m) * math.pow((l / k_m), 2.0)) * math.pow(math.sin(k_m), -2.0)) / 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 (k_m <= 1.4e-24)
		tmp = Float64(2.0 * (Float64(Float64(k_m / Float64(l / sin(k_m))) * sqrt(Float64(t_m / cos(k_m)))) ^ -2.0));
	else
		tmp = Float64(2.0 * Float64(Float64(Float64(cos(k_m) * (Float64(l / k_m) ^ 2.0)) * (sin(k_m) ^ -2.0)) / 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 (k_m <= 1.4e-24)
		tmp = 2.0 * (((k_m / (l / sin(k_m))) * sqrt((t_m / cos(k_m)))) ^ -2.0);
	else
		tmp = 2.0 * (((cos(k_m) * ((l / k_m) ^ 2.0)) * (sin(k_m) ^ -2.0)) / 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[LessEqual[k$95$m, 1.4e-24], N[(2.0 * N[Power[N[(N[(k$95$m / N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(t$95$m / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[Sin[k$95$m], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

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

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


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

    1. Initial program 34.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*34.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4000000000000001e-24 < k

    1. Initial program 31.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-*l*31.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 73.5% 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 5.5 \cdot 10^{-93}:\\ \;\;\;\;2 \cdot \frac{\frac{{\left(\frac{\ell}{k_m}\right)}^{2}}{{\sin k_m}^{2}}}{t_m}\\ \mathbf{elif}\;t_m \leq 7.2 \cdot 10^{+74}:\\ \;\;\;\;\frac{2}{\frac{\frac{k_m}{t_m}}{\frac{t_m}{k_m}} \cdot \left(\left(\sin k_m \cdot \tan k_m\right) \cdot \left(\frac{{t_m}^{2}}{\ell} \cdot \frac{t_m}{\ell}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2} \cdot \sqrt{t_m}}{\ell}\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 (<= t_m 5.5e-93)
    (* 2.0 (/ (/ (pow (/ l k_m) 2.0) (pow (sin k_m) 2.0)) t_m))
    (if (<= t_m 7.2e+74)
      (/
       2.0
       (*
        (/ (/ k_m t_m) (/ t_m k_m))
        (* (* (sin k_m) (tan k_m)) (* (/ (pow t_m 2.0) l) (/ t_m l)))))
      (/ 2.0 (pow (/ (* (pow k_m 2.0) (sqrt t_m)) l) 2.0))))))
k_m = fabs(k);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (t_m <= 5.5e-93) {
		tmp = 2.0 * ((pow((l / k_m), 2.0) / pow(sin(k_m), 2.0)) / t_m);
	} else if (t_m <= 7.2e+74) {
		tmp = 2.0 / (((k_m / t_m) / (t_m / k_m)) * ((sin(k_m) * tan(k_m)) * ((pow(t_m, 2.0) / l) * (t_m / l))));
	} else {
		tmp = 2.0 / pow(((pow(k_m, 2.0) * sqrt(t_m)) / l), 2.0);
	}
	return t_s * tmp;
}
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    real(8) :: tmp
    if (t_m <= 5.5d-93) then
        tmp = 2.0d0 * ((((l / k_m) ** 2.0d0) / (sin(k_m) ** 2.0d0)) / t_m)
    else if (t_m <= 7.2d+74) then
        tmp = 2.0d0 / (((k_m / t_m) / (t_m / k_m)) * ((sin(k_m) * tan(k_m)) * (((t_m ** 2.0d0) / l) * (t_m / l))))
    else
        tmp = 2.0d0 / ((((k_m ** 2.0d0) * sqrt(t_m)) / l) ** 2.0d0)
    end if
    code = t_s * tmp
end function
k_m = Math.abs(k);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (t_m <= 5.5e-93) {
		tmp = 2.0 * ((Math.pow((l / k_m), 2.0) / Math.pow(Math.sin(k_m), 2.0)) / t_m);
	} else if (t_m <= 7.2e+74) {
		tmp = 2.0 / (((k_m / t_m) / (t_m / k_m)) * ((Math.sin(k_m) * Math.tan(k_m)) * ((Math.pow(t_m, 2.0) / l) * (t_m / l))));
	} else {
		tmp = 2.0 / Math.pow(((Math.pow(k_m, 2.0) * Math.sqrt(t_m)) / l), 2.0);
	}
	return t_s * tmp;
}
k_m = math.fabs(k)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k_m):
	tmp = 0
	if t_m <= 5.5e-93:
		tmp = 2.0 * ((math.pow((l / k_m), 2.0) / math.pow(math.sin(k_m), 2.0)) / t_m)
	elif t_m <= 7.2e+74:
		tmp = 2.0 / (((k_m / t_m) / (t_m / k_m)) * ((math.sin(k_m) * math.tan(k_m)) * ((math.pow(t_m, 2.0) / l) * (t_m / l))))
	else:
		tmp = 2.0 / math.pow(((math.pow(k_m, 2.0) * math.sqrt(t_m)) / l), 2.0)
	return t_s * tmp
k_m = abs(k)
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	tmp = 0.0
	if (t_m <= 5.5e-93)
		tmp = Float64(2.0 * Float64(Float64((Float64(l / k_m) ^ 2.0) / (sin(k_m) ^ 2.0)) / t_m));
	elseif (t_m <= 7.2e+74)
		tmp = Float64(2.0 / Float64(Float64(Float64(k_m / t_m) / Float64(t_m / k_m)) * Float64(Float64(sin(k_m) * tan(k_m)) * Float64(Float64((t_m ^ 2.0) / l) * Float64(t_m / l)))));
	else
		tmp = Float64(2.0 / (Float64(Float64((k_m ^ 2.0) * sqrt(t_m)) / l) ^ 2.0));
	end
	return Float64(t_s * tmp)
end
k_m = abs(k);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k_m)
	tmp = 0.0;
	if (t_m <= 5.5e-93)
		tmp = 2.0 * ((((l / k_m) ^ 2.0) / (sin(k_m) ^ 2.0)) / t_m);
	elseif (t_m <= 7.2e+74)
		tmp = 2.0 / (((k_m / t_m) / (t_m / k_m)) * ((sin(k_m) * tan(k_m)) * (((t_m ^ 2.0) / l) * (t_m / l))));
	else
		tmp = 2.0 / ((((k_m ^ 2.0) * sqrt(t_m)) / l) ^ 2.0);
	end
	tmp_2 = t_s * tmp;
end
k_m = N[Abs[k], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-93], N[(2.0 * N[(N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 7.2e+74], N[(2.0 / N[(N[(N[(k$95$m / t$95$m), $MachinePrecision] / N[(t$95$m / k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[t$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[Power[N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 5.5 \cdot 10^{-93}:\\
\;\;\;\;2 \cdot \frac{\frac{{\left(\frac{\ell}{k_m}\right)}^{2}}{{\sin k_m}^{2}}}{t_m}\\

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

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


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

    1. Initial program 28.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-*l*28.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \frac{\frac{\color{blue}{\frac{\ell}{k} \cdot \frac{\ell}{k}}}{{\sin k}^{2}}}{t} \]
      4. unpow270.0%

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

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

    if 5.49999999999999968e-93 < t < 7.19999999999999975e74

    1. Initial program 77.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-*l*77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.19999999999999975e74 < t

    1. Initial program 22.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-*l*22.9%

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2}\right)\right)}} \]
      2. expm1-log1p51.7%

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

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

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

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

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

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

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

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

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 7.5 \cdot 10^{-93}:\\
\;\;\;\;2 \cdot \frac{\frac{{\left(\frac{\ell}{k_m}\right)}^{2}}{{\sin k_m}^{2}}}{t_m}\\

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

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


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

    1. Initial program 28.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-*l*28.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \frac{\frac{\color{blue}{\frac{\ell}{k} \cdot \frac{\ell}{k}}}{{\sin k}^{2}}}{t} \]
      4. unpow270.0%

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

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

    if 7.50000000000000034e-93 < t < 7.00000000000000029e74

    1. Initial program 77.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-*l*77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.00000000000000029e74 < t

    1. Initial program 22.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-*l*22.9%

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2}\right)\right)}} \]
      2. expm1-log1p51.7%

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

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

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

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

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

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

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

Alternative 7: 73.2% 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 10^{+204}:\\ \;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \frac{\frac{{\left(\frac{\ell}{k_m}\right)}^{2}}{{\sin k_m}^{2}}}{t_m}\\ \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) 1e+204)
    (/ 2.0 (pow (* (/ (pow k_m 2.0) l) (sqrt t_m)) 2.0))
    (* 2.0 (/ (/ (pow (/ l k_m) 2.0) (pow (sin k_m) 2.0)) 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) <= 1e+204) {
		tmp = 2.0 / pow(((pow(k_m, 2.0) / l) * sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * ((pow((l / k_m), 2.0) / pow(sin(k_m), 2.0)) / 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) <= 1d+204) then
        tmp = 2.0d0 / ((((k_m ** 2.0d0) / l) * sqrt(t_m)) ** 2.0d0)
    else
        tmp = 2.0d0 * ((((l / k_m) ** 2.0d0) / (sin(k_m) ** 2.0d0)) / 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) <= 1e+204) {
		tmp = 2.0 / Math.pow(((Math.pow(k_m, 2.0) / l) * Math.sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * ((Math.pow((l / k_m), 2.0) / Math.pow(Math.sin(k_m), 2.0)) / 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) <= 1e+204:
		tmp = 2.0 / math.pow(((math.pow(k_m, 2.0) / l) * math.sqrt(t_m)), 2.0)
	else:
		tmp = 2.0 * ((math.pow((l / k_m), 2.0) / math.pow(math.sin(k_m), 2.0)) / 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) <= 1e+204)
		tmp = Float64(2.0 / (Float64(Float64((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0));
	else
		tmp = Float64(2.0 * Float64(Float64((Float64(l / k_m) ^ 2.0) / (sin(k_m) ^ 2.0)) / 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) <= 1e+204)
		tmp = 2.0 / ((((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0);
	else
		tmp = 2.0 * ((((l / k_m) ^ 2.0) / (sin(k_m) ^ 2.0)) / 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[LessEqual[N[(l * l), $MachinePrecision], 1e+204], N[(2.0 / N[Power[N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / t$95$m), $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 10^{+204}:\\
\;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999989e203 < (*.f64 l l)

    1. Initial program 27.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-*l*27.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \frac{\frac{\color{blue}{\frac{{\ell}^{2}}{{k}^{2}}}}{{\sin k}^{2}}}{t} \]
    13. Step-by-step derivation
      1. unpow249.0%

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

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

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

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

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

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

Alternative 8: 72.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 \leq 5.4 \cdot 10^{-101}:\\ \;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{{k_m}^{-2} + -0.16666666666666666}{t_m}\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 5.4e-101)
    (/ 2.0 (pow (* (/ (pow k_m 2.0) l) (sqrt t_m)) 2.0))
    (*
     2.0
     (*
      (pow (/ l k_m) 2.0)
      (/ (+ (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 <= 5.4e-101) {
		tmp = 2.0 / pow(((pow(k_m, 2.0) / l) * sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * (pow((l / k_m), 2.0) * ((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 <= 5.4d-101) then
        tmp = 2.0d0 / ((((k_m ** 2.0d0) / l) * sqrt(t_m)) ** 2.0d0)
    else
        tmp = 2.0d0 * (((l / k_m) ** 2.0d0) * (((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 <= 5.4e-101) {
		tmp = 2.0 / Math.pow(((Math.pow(k_m, 2.0) / l) * Math.sqrt(t_m)), 2.0);
	} else {
		tmp = 2.0 * (Math.pow((l / k_m), 2.0) * ((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 <= 5.4e-101:
		tmp = 2.0 / math.pow(((math.pow(k_m, 2.0) / l) * math.sqrt(t_m)), 2.0)
	else:
		tmp = 2.0 * (math.pow((l / k_m), 2.0) * ((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 (l <= 5.4e-101)
		tmp = Float64(2.0 / (Float64(Float64((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0));
	else
		tmp = Float64(2.0 * Float64((Float64(l / k_m) ^ 2.0) * Float64(Float64((k_m ^ -2.0) + -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 <= 5.4e-101)
		tmp = 2.0 / ((((k_m ^ 2.0) / l) * sqrt(t_m)) ^ 2.0);
	else
		tmp = 2.0 * (((l / k_m) ^ 2.0) * (((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[LessEqual[l, 5.4e-101], N[(2.0 / N[Power[N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[Power[k$95$m, -2.0], $MachinePrecision] + -0.16666666666666666), $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 \begin{array}{l}
\mathbf{if}\;\ell \leq 5.4 \cdot 10^{-101}:\\
\;\;\;\;\frac{2}{{\left(\frac{{k_m}^{2}}{\ell} \cdot \sqrt{t_m}\right)}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.4000000000000003e-101

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

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

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

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

    if 5.4000000000000003e-101 < l

    1. Initial program 37.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*37.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-/r*37.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
    8. Taylor expanded in k around 0 58.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) \]
    9. Step-by-step derivation
      1. associate-/r*58.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{{\left(e^{\color{blue}{2 \cdot \log k}}\right)}^{-1} + \left(-0.16666666666666666\right)}{t}\right) \]
      10. exp-prod43.2%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\color{blue}{e^{\left(2 \cdot \log k\right) \cdot -1}} + \left(-0.16666666666666666\right)}{t}\right) \]
      11. *-commutative43.2%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{-1 \cdot \left(2 \cdot \log k\right)}} + \left(-0.16666666666666666\right)}{t}\right) \]
      12. associate-*r*43.2%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{\left(-1 \cdot 2\right) \cdot \log k}} + \left(-0.16666666666666666\right)}{t}\right) \]
      13. metadata-eval43.2%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{-2} \cdot \log k} + \left(-0.16666666666666666\right)}{t}\right) \]
      14. *-commutative43.2%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{\log k \cdot -2}} + \left(-0.16666666666666666\right)}{t}\right) \]
      15. exp-to-pow60.7%

        \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\color{blue}{{k}^{-2}} + \left(-0.16666666666666666\right)}{t}\right) \]
      16. metadata-eval60.7%

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

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

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

Alternative 9: 63.6% accurate, 2.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;k_m \leq 7.2 \cdot 10^{+49}:\\ \;\;\;\;\frac{2}{t_m \cdot {k_m}^{4}} \cdot {\ell}^{2}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{-0.16666666666666666}{t_m}\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 7.2e+49)
    (* (/ 2.0 (* t_m (pow k_m 4.0))) (pow l 2.0))
    (* 2.0 (* (pow (/ l 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 (k_m <= 7.2e+49) {
		tmp = (2.0 / (t_m * pow(k_m, 4.0))) * pow(l, 2.0);
	} else {
		tmp = 2.0 * (pow((l / 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 (k_m <= 7.2d+49) then
        tmp = (2.0d0 / (t_m * (k_m ** 4.0d0))) * (l ** 2.0d0)
    else
        tmp = 2.0d0 * (((l / 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 (k_m <= 7.2e+49) {
		tmp = (2.0 / (t_m * Math.pow(k_m, 4.0))) * Math.pow(l, 2.0);
	} else {
		tmp = 2.0 * (Math.pow((l / 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 k_m <= 7.2e+49:
		tmp = (2.0 / (t_m * math.pow(k_m, 4.0))) * math.pow(l, 2.0)
	else:
		tmp = 2.0 * (math.pow((l / 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 (k_m <= 7.2e+49)
		tmp = Float64(Float64(2.0 / Float64(t_m * (k_m ^ 4.0))) * (l ^ 2.0));
	else
		tmp = Float64(2.0 * Float64((Float64(l / 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 (k_m <= 7.2e+49)
		tmp = (2.0 / (t_m * (k_m ^ 4.0))) * (l ^ 2.0);
	else
		tmp = 2.0 * (((l / 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[LessEqual[k$95$m, 7.2e+49], N[(N[(2.0 / N[(t$95$m * N[Power[k$95$m, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.16666666666666666 / 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 \begin{array}{l}
\mathbf{if}\;k_m \leq 7.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{2}{t_m \cdot {k_m}^{4}} \cdot {\ell}^{2}\\

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


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

    1. Initial program 32.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-*l*32.4%

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

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

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

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

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

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

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

    if 7.19999999999999993e49 < k

    1. Initial program 37.2%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*37.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-/r*37.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
    8. Taylor expanded in k around 0 63.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) \]
    9. Step-by-step derivation
      1. associate-/r*63.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\frac{-0.16666666666666666}{t} \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot k}}\right) \]
      6. times-frac66.6%

        \[\leadsto 2 \cdot \left(\frac{-0.16666666666666666}{t} \cdot \color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}\right) \]
      7. unpow266.6%

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

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

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

Alternative 10: 63.4% accurate, 2.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;k_m \leq 7.2 \cdot 10^{+49}:\\ \;\;\;\;\frac{2}{\left(t_m \cdot {k_m}^{4}\right) \cdot {\ell}^{-2}}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{-0.16666666666666666}{t_m}\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 7.2e+49)
    (/ 2.0 (* (* t_m (pow k_m 4.0)) (pow l -2.0)))
    (* 2.0 (* (pow (/ l 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 (k_m <= 7.2e+49) {
		tmp = 2.0 / ((t_m * pow(k_m, 4.0)) * pow(l, -2.0));
	} else {
		tmp = 2.0 * (pow((l / 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 (k_m <= 7.2d+49) then
        tmp = 2.0d0 / ((t_m * (k_m ** 4.0d0)) * (l ** (-2.0d0)))
    else
        tmp = 2.0d0 * (((l / 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 (k_m <= 7.2e+49) {
		tmp = 2.0 / ((t_m * Math.pow(k_m, 4.0)) * Math.pow(l, -2.0));
	} else {
		tmp = 2.0 * (Math.pow((l / 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 k_m <= 7.2e+49:
		tmp = 2.0 / ((t_m * math.pow(k_m, 4.0)) * math.pow(l, -2.0))
	else:
		tmp = 2.0 * (math.pow((l / 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 (k_m <= 7.2e+49)
		tmp = Float64(2.0 / Float64(Float64(t_m * (k_m ^ 4.0)) * (l ^ -2.0)));
	else
		tmp = Float64(2.0 * Float64((Float64(l / 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 (k_m <= 7.2e+49)
		tmp = 2.0 / ((t_m * (k_m ^ 4.0)) * (l ^ -2.0));
	else
		tmp = 2.0 * (((l / 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[LessEqual[k$95$m, 7.2e+49], N[(2.0 / N[(N[(t$95$m * N[Power[k$95$m, 4.0], $MachinePrecision]), $MachinePrecision] * N[Power[l, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.16666666666666666 / 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 \begin{array}{l}
\mathbf{if}\;k_m \leq 7.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{2}{\left(t_m \cdot {k_m}^{4}\right) \cdot {\ell}^{-2}}\\

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


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

    1. Initial program 32.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-*l*32.4%

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{e^{\mathsf{log1p}\left(\frac{{k}^{4} \cdot t}{{\ell}^{2}}\right)} - 1}} \]
      3. div-inv25.8%

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

        \[\leadsto \frac{2}{e^{\mathsf{log1p}\left(\color{blue}{\left(t \cdot {k}^{4}\right)} \cdot \frac{1}{{\ell}^{2}}\right)} - 1} \]
      5. pow-flip25.8%

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

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

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

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

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

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

    if 7.19999999999999993e49 < k

    1. Initial program 37.2%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*37.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-/r*37.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
    8. Taylor expanded in k around 0 63.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) \]
    9. Step-by-step derivation
      1. associate-/r*63.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\frac{-0.16666666666666666}{t} \cdot \frac{\ell \cdot \ell}{\color{blue}{k \cdot k}}\right) \]
      6. times-frac66.6%

        \[\leadsto 2 \cdot \left(\frac{-0.16666666666666666}{t} \cdot \color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}\right) \]
      7. unpow266.6%

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

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

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

Alternative 11: 71.0% accurate, 2.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \left(2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{{k_m}^{-2} + -0.16666666666666666}{t_m}\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
   (* (pow (/ l k_m) 2.0) (/ (+ (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 * (pow((l / k_m), 2.0) * ((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 / k_m) ** 2.0d0) * (((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 * (Math.pow((l / k_m), 2.0) * ((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 * (math.pow((l / k_m), 2.0) * ((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(l / k_m) ^ 2.0) * Float64(Float64((k_m ^ -2.0) + -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 / k_m) ^ 2.0) * (((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[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[Power[k$95$m, -2.0], $MachinePrecision] + -0.16666666666666666), $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 \left(2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{{k_m}^{-2} + -0.16666666666666666}{t_m}\right)\right)
\end{array}
Derivation
  1. Initial program 33.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-*l*33.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
  8. Taylor expanded in k around 0 64.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) \]
  9. Step-by-step derivation
    1. associate-/r*64.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\color{blue}{{\left({k}^{2}\right)}^{-1}} + \left(-0.16666666666666666\right)}{t}\right) \]
    8. exp-to-pow42.4%

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

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{{\left(e^{\color{blue}{2 \cdot \log k}}\right)}^{-1} + \left(-0.16666666666666666\right)}{t}\right) \]
    10. exp-prod42.4%

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{\color{blue}{e^{\left(2 \cdot \log k\right) \cdot -1}} + \left(-0.16666666666666666\right)}{t}\right) \]
    11. *-commutative42.4%

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{-1 \cdot \left(2 \cdot \log k\right)}} + \left(-0.16666666666666666\right)}{t}\right) \]
    12. associate-*r*42.4%

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{\left(-1 \cdot 2\right) \cdot \log k}} + \left(-0.16666666666666666\right)}{t}\right) \]
    13. metadata-eval42.4%

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{-2} \cdot \log k} + \left(-0.16666666666666666\right)}{t}\right) \]
    14. *-commutative42.4%

      \[\leadsto 2 \cdot \left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{e^{\color{blue}{\log k \cdot -2}} + \left(-0.16666666666666666\right)}{t}\right) \]
    15. exp-to-pow71.4%

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

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

    \[\leadsto 2 \cdot \color{blue}{\left({\left(\frac{\ell}{k}\right)}^{2} \cdot \frac{{k}^{-2} + -0.16666666666666666}{t}\right)} \]
  14. Final simplification71.4%

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

Alternative 12: 34.9% 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 \left(2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{-0.16666666666666666}{t_m}\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 (* (pow (/ l 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 * (pow((l / 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 / 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 * (Math.pow((l / 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 * (math.pow((l / 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(l / 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 / 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[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.16666666666666666 / 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 \left(2 \cdot \left({\left(\frac{\ell}{k_m}\right)}^{2} \cdot \frac{-0.16666666666666666}{t_m}\right)\right)
\end{array}
Derivation
  1. Initial program 33.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-*l*33.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right)} \]
  8. Taylor expanded in k around 0 64.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) \]
  9. Step-by-step derivation
    1. associate-/r*64.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\frac{-0.16666666666666666}{t} \cdot \color{blue}{\left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)}\right) \]
    7. unpow239.4%

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

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

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

Reproduce

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