Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.1% → 99.4%
Time: 18.1s
Alternatives: 10
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 10 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: 36.1% 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: 99.4% accurate, 0.8× speedup?

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

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


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

    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. 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)}} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4999999999999999e-156 < k

    1. Initial program 26.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. Simplified40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 36.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. Simplified44.2%

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999978e-128 < k

    1. Initial program 24.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. Simplified38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 75.8% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 4.8 \cdot 10^{-138}:\\ \;\;\;\;\cos k\_m \cdot \frac{{\left(\ell \cdot \frac{\sqrt{2}}{{k\_m}^{2}}\right)}^{2}}{t\_m}\\ \mathbf{elif}\;t\_m \leq 3.6 \cdot 10^{-18}:\\ \;\;\;\;\frac{2}{\left(\left(\frac{{t\_m}^{2}}{\ell} \cdot \frac{t\_m}{\ell}\right) \cdot \left(\sin k\_m \cdot \tan k\_m\right)\right) \cdot \frac{k\_m \cdot \frac{k\_m}{t\_m}}{t\_m}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\ell \cdot {\left(\frac{\sqrt{\sqrt{\frac{2}{t\_m}}}}{k\_m}\right)}^{2}\right)}^{2}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 4.8e-138)
    (* (cos k_m) (/ (pow (* l (/ (sqrt 2.0) (pow k_m 2.0))) 2.0) t_m))
    (if (<= t_m 3.6e-18)
      (/
       2.0
       (*
        (* (* (/ (pow t_m 2.0) l) (/ t_m l)) (* (sin k_m) (tan k_m)))
        (/ (* k_m (/ k_m t_m)) t_m)))
      (pow (* l (pow (/ (sqrt (sqrt (/ 2.0 t_m))) k_m) 2.0)) 2.0)))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (t_m <= 4.8e-138) {
		tmp = cos(k_m) * (pow((l * (sqrt(2.0) / pow(k_m, 2.0))), 2.0) / t_m);
	} else if (t_m <= 3.6e-18) {
		tmp = 2.0 / ((((pow(t_m, 2.0) / l) * (t_m / l)) * (sin(k_m) * tan(k_m))) * ((k_m * (k_m / t_m)) / t_m));
	} else {
		tmp = pow((l * pow((sqrt(sqrt((2.0 / t_m))) / k_m), 2.0)), 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 <= 4.8d-138) then
        tmp = cos(k_m) * (((l * (sqrt(2.0d0) / (k_m ** 2.0d0))) ** 2.0d0) / t_m)
    else if (t_m <= 3.6d-18) then
        tmp = 2.0d0 / (((((t_m ** 2.0d0) / l) * (t_m / l)) * (sin(k_m) * tan(k_m))) * ((k_m * (k_m / t_m)) / t_m))
    else
        tmp = (l * ((sqrt(sqrt((2.0d0 / t_m))) / k_m) ** 2.0d0)) ** 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 <= 4.8e-138) {
		tmp = Math.cos(k_m) * (Math.pow((l * (Math.sqrt(2.0) / Math.pow(k_m, 2.0))), 2.0) / t_m);
	} else if (t_m <= 3.6e-18) {
		tmp = 2.0 / ((((Math.pow(t_m, 2.0) / l) * (t_m / l)) * (Math.sin(k_m) * Math.tan(k_m))) * ((k_m * (k_m / t_m)) / t_m));
	} else {
		tmp = Math.pow((l * Math.pow((Math.sqrt(Math.sqrt((2.0 / t_m))) / k_m), 2.0)), 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 <= 4.8e-138:
		tmp = math.cos(k_m) * (math.pow((l * (math.sqrt(2.0) / math.pow(k_m, 2.0))), 2.0) / t_m)
	elif t_m <= 3.6e-18:
		tmp = 2.0 / ((((math.pow(t_m, 2.0) / l) * (t_m / l)) * (math.sin(k_m) * math.tan(k_m))) * ((k_m * (k_m / t_m)) / t_m))
	else:
		tmp = math.pow((l * math.pow((math.sqrt(math.sqrt((2.0 / t_m))) / k_m), 2.0)), 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 <= 4.8e-138)
		tmp = Float64(cos(k_m) * Float64((Float64(l * Float64(sqrt(2.0) / (k_m ^ 2.0))) ^ 2.0) / t_m));
	elseif (t_m <= 3.6e-18)
		tmp = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 2.0) / l) * Float64(t_m / l)) * Float64(sin(k_m) * tan(k_m))) * Float64(Float64(k_m * Float64(k_m / t_m)) / t_m)));
	else
		tmp = Float64(l * (Float64(sqrt(sqrt(Float64(2.0 / t_m))) / k_m) ^ 2.0)) ^ 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 <= 4.8e-138)
		tmp = cos(k_m) * (((l * (sqrt(2.0) / (k_m ^ 2.0))) ^ 2.0) / t_m);
	elseif (t_m <= 3.6e-18)
		tmp = 2.0 / (((((t_m ^ 2.0) / l) * (t_m / l)) * (sin(k_m) * tan(k_m))) * ((k_m * (k_m / t_m)) / t_m));
	else
		tmp = (l * ((sqrt(sqrt((2.0 / t_m))) / k_m) ^ 2.0)) ^ 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, 4.8e-138], N[(N[Cos[k$95$m], $MachinePrecision] * N[(N[Power[N[(l * N[(N[Sqrt[2.0], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.6e-18], N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m * N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(l * N[Power[N[(N[Sqrt[N[Sqrt[N[(2.0 / t$95$m), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / k$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 4.8 \cdot 10^{-138}:\\
\;\;\;\;\cos k\_m \cdot \frac{{\left(\ell \cdot \frac{\sqrt{2}}{{k\_m}^{2}}\right)}^{2}}{t\_m}\\

\mathbf{elif}\;t\_m \leq 3.6 \cdot 10^{-18}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{{t\_m}^{2}}{\ell} \cdot \frac{t\_m}{\ell}\right) \cdot \left(\sin k\_m \cdot \tan k\_m\right)\right) \cdot \frac{k\_m \cdot \frac{k\_m}{t\_m}}{t\_m}}\\

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


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

    1. Initial program 31.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7999999999999998e-138 < t < 3.6000000000000001e-18

    1. Initial program 48.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. Simplified48.2%

      \[\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)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. +-commutative48.2%

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

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

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

        \[\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}}} \]
      5. unpow250.9%

        \[\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)}} \]
      6. associate-*r/50.9%

        \[\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} \cdot k}{t}}} \]
    5. Applied egg-rr50.9%

      \[\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} \cdot k}{t}}} \]
    6. Step-by-step derivation
      1. unpow350.9%

        \[\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} \cdot k}{t}} \]
      2. times-frac66.7%

        \[\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} \cdot k}{t}} \]
      3. pow266.7%

        \[\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} \cdot k}{t}} \]
    7. Applied egg-rr66.7%

      \[\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} \cdot k}{t}} \]

    if 3.6000000000000001e-18 < t

    1. Initial program 29.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. Simplified47.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\ell \cdot \color{blue}{\left(\sqrt{2} \cdot \frac{\sqrt{\frac{1}{t}}}{{k}^{2}}\right)}\right)}^{2} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.4%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\ell \cdot {\left(\frac{\sqrt{\sqrt{\frac{2}{t}}}}{\color{blue}{k}}\right)}^{2}\right)}^{2} \]
    12. Applied egg-rr81.9%

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

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

Alternative 4: 75.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_2 := \sqrt{\frac{2}{t\_m}}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 4 \cdot 10^{-91}:\\
\;\;\;\;{\left(\frac{\ell \cdot t\_2}{{k\_m}^{2}}\right)}^{2}\\

\mathbf{elif}\;t\_m \leq 2.55 \cdot 10^{-20}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{{t\_m}^{2}}{\ell} \cdot \frac{t\_m}{\ell}\right) \cdot \left(\sin k\_m \cdot \tan k\_m\right)\right) \cdot \frac{k\_m \cdot \frac{k\_m}{t\_m}}{t\_m}}\\

\mathbf{else}:\\
\;\;\;\;{\left(\ell \cdot {\left(\frac{\sqrt{t\_2}}{k\_m}\right)}^{2}\right)}^{2}\\


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

    1. Initial program 30.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. Simplified38.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\sqrt{{\left({\left(\frac{2}{t \cdot {k}^{4}} \cdot {\ell}^{2}\right)}^{3}\right)}^{0.3333333333333333}}\right)}^{2}} \]
      7. unpow1/333.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.00000000000000009e-91 < t < 2.55000000000000009e-20

    1. Initial program 68.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. Simplified68.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)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. +-commutative68.9%

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

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

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

        \[\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}}} \]
      5. unpow268.9%

        \[\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)}} \]
      6. associate-*r/68.9%

        \[\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} \cdot k}{t}}} \]
    5. Applied egg-rr68.9%

      \[\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} \cdot k}{t}}} \]
    6. Step-by-step derivation
      1. unpow368.9%

        \[\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} \cdot k}{t}} \]
      2. times-frac75.5%

        \[\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} \cdot k}{t}} \]
      3. pow275.5%

        \[\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} \cdot k}{t}} \]
    7. Applied egg-rr75.5%

      \[\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} \cdot k}{t}} \]

    if 2.55000000000000009e-20 < t

    1. Initial program 29.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. Simplified47.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\ell \cdot \color{blue}{\left(\sqrt{2} \cdot \frac{\sqrt{\frac{1}{t}}}{{k}^{2}}\right)}\right)}^{2} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.4%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\ell \cdot {\left(\frac{\sqrt{\sqrt{\frac{2}{t}}}}{\color{blue}{k}}\right)}^{2}\right)}^{2} \]
    12. Applied egg-rr81.9%

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

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

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

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


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

    1. Initial program 34.7%

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

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

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

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

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

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

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

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

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

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

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

    if 1.84999999999999991e-5 < k

    1. Initial program 25.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.0% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\cos k\_m \cdot \frac{{\left(\frac{\sqrt{2} \cdot \frac{\ell}{\sin k\_m}}{k\_m}\right)}^{2}}{t\_m}\right) \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (*
  t_s
  (* (cos k_m) (/ (pow (/ (* (sqrt 2.0) (/ l (sin k_m))) 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) {
	return t_s * (cos(k_m) * (pow(((sqrt(2.0) * (l / sin(k_m))) / k_m), 2.0) / 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 * (cos(k_m) * ((((sqrt(2.0d0) * (l / sin(k_m))) / k_m) ** 2.0d0) / 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 * (Math.cos(k_m) * (Math.pow(((Math.sqrt(2.0) * (l / Math.sin(k_m))) / k_m), 2.0) / 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 * (math.cos(k_m) * (math.pow(((math.sqrt(2.0) * (l / math.sin(k_m))) / k_m), 2.0) / 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(cos(k_m) * Float64((Float64(Float64(sqrt(2.0) * Float64(l / sin(k_m))) / k_m) ^ 2.0) / 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 * (cos(k_m) * ((((sqrt(2.0) * (l / sin(k_m))) / k_m) ^ 2.0) / 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[(N[Cos[k$95$m], $MachinePrecision] * N[(N[Power[N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(l / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k$95$m), $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 \left(\cos k\_m \cdot \frac{{\left(\frac{\sqrt{2} \cdot \frac{\ell}{\sin k\_m}}{k\_m}\right)}^{2}}{t\_m}\right)
\end{array}
Derivation
  1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.0% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\cos k\_m \cdot \frac{{\left(\frac{\sqrt{2}}{k\_m} \cdot \frac{\ell}{\sin k\_m}\right)}^{2}}{t\_m}\right) \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (*
  t_s
  (* (cos k_m) (/ (pow (* (/ (sqrt 2.0) k_m) (/ l (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) {
	return t_s * (cos(k_m) * (pow(((sqrt(2.0) / k_m) * (l / sin(k_m))), 2.0) / 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 * (cos(k_m) * ((((sqrt(2.0d0) / k_m) * (l / sin(k_m))) ** 2.0d0) / 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 * (Math.cos(k_m) * (Math.pow(((Math.sqrt(2.0) / k_m) * (l / Math.sin(k_m))), 2.0) / 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 * (math.cos(k_m) * (math.pow(((math.sqrt(2.0) / k_m) * (l / math.sin(k_m))), 2.0) / 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(cos(k_m) * Float64((Float64(Float64(sqrt(2.0) / k_m) * Float64(l / sin(k_m))) ^ 2.0) / 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 * (cos(k_m) * ((((sqrt(2.0) / k_m) * (l / sin(k_m))) ^ 2.0) / 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[(N[Cos[k$95$m], $MachinePrecision] * N[(N[Power[N[(N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[Sin[k$95$m], $MachinePrecision]), $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 \left(\cos k\_m \cdot \frac{{\left(\frac{\sqrt{2}}{k\_m} \cdot \frac{\ell}{\sin k\_m}\right)}^{2}}{t\_m}\right)
\end{array}
Derivation
  1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.6% accurate, 1.4× speedup?

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

\\
t\_s \cdot {\left(\frac{\ell \cdot \sqrt{\frac{2}{t\_m}}}{{k\_m}^{2}}\right)}^{2}
\end{array}
Derivation
  1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sqrt{{\left({\left(\frac{2}{t \cdot {k}^{4}} \cdot {\ell}^{2}\right)}^{3}\right)}^{0.3333333333333333}}\right)}^{2}} \]
    7. unpow1/343.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 73.8% accurate, 1.4× speedup?

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

\\
t\_s \cdot {\left(\ell \cdot \frac{\sqrt{\frac{2}{t\_m}}}{{k\_m}^{2}}\right)}^{2}
\end{array}
Derivation
  1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sqrt{{\left({\left(\frac{2}{t \cdot {k}^{4}} \cdot {\ell}^{2}\right)}^{3}\right)}^{0.3333333333333333}}\right)}^{2}} \]
    7. unpow1/343.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

\\
t\_s \cdot \left(\ell \cdot \left(2 \cdot \frac{\ell}{t\_m \cdot {k\_m}^{4}}\right)\right)
\end{array}
Derivation
  1. Initial program 32.7%

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

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

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

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

      \[\leadsto \color{blue}{{\left(\left(\left(\frac{2}{{k}^{4} \cdot t} \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(\frac{2}{{k}^{4} \cdot t} \cdot \left(\ell \cdot \ell\right)\right)\right) \cdot \left(\frac{2}{{k}^{4} \cdot t} \cdot \left(\ell \cdot \ell\right)\right)\right)}^{0.3333333333333333}} \]
    3. pow343.6%

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

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

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

    \[\leadsto \color{blue}{{\left({\left(\frac{2}{t \cdot {k}^{4}} \cdot {\ell}^{2}\right)}^{3}\right)}^{0.3333333333333333}} \]
  7. Step-by-step derivation
    1. unpow1/356.4%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\left(\frac{2}{t} \cdot {k}^{-4}\right) \cdot \ell\right) \cdot \ell} \]
  9. Taylor expanded in t around 0 66.3%

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

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

Reproduce

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