Toniolo and Linder, Equation (10-)

Percentage Accurate: 35.5% → 95.7%
Time: 15.3s
Alternatives: 12
Speedup: 3.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 35.5% accurate, 1.0× speedup?

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

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

Alternative 1: 95.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 40.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. Add Preprocessing
    3. Taylor expanded in t around 0 74.6%

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

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

      \[\leadsto \frac{2}{\color{blue}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}}} \]
    6. Step-by-step derivation
      1. div-inv76.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{2}{{k}^{2}}}{t \cdot \frac{{\sin k}^{2}}{\cos k \cdot {\ell}^{2}}}} \]
      4. *-lft-identity77.8%

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{\frac{2}{{k}^{2}}}{t \cdot \frac{{\sin k}^{2}}{{\ell}^{2} \cdot \cos k}}} \cdot \sqrt{\frac{\frac{2}{{k}^{2}}}{t \cdot \frac{{\sin k}^{2}}{{\ell}^{2} \cdot \cos k}}}} \]
    11. Applied egg-rr45.1%

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{2}}{k}}{\sqrt{t} \cdot \frac{\sin k}{\ell \cdot \sqrt{\cos k}}} \cdot \frac{\frac{\sqrt{2}}{k}}{\sqrt{t} \cdot \frac{\sin k}{\ell \cdot \sqrt{\cos k}}}} \]
    12. Step-by-step derivation
      1. unpow245.1%

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

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

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

    if 2.3e-6 < k

    1. Initial program 27.1%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified39.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-sqrt33.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. pow233.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.1%

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

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

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
    8. Taylor expanded in l around 0 47.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. unpow-prod-down44.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 40.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. Simplified43.9%

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

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

        \[\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-rr30.7%

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

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

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

      \[\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. associate-*l/50.1%

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

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

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

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

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

    if 2.3e-6 < k

    1. Initial program 27.1%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified39.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-sqrt33.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. pow233.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.1%

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

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

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
    8. Taylor expanded in l around 0 47.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. unpow-prod-down44.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 40.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. Simplified43.9%

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

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

        \[\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-rr30.7%

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

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

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

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

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

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

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

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

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

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

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

    if 2.3e-6 < k

    1. Initial program 27.1%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified39.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-sqrt33.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. pow233.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.1%

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

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

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
    8. Taylor expanded in l around 0 47.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. unpow-prod-down44.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 40.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. Simplified43.9%

      \[\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 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9e-6 < k

    1. Initial program 27.1%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified39.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-sqrt33.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. pow233.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.1%

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

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

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
    8. Taylor expanded in l around 0 47.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. *-un-lft-identity47.6%

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

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

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

        \[\leadsto 1 \cdot \left(\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}\right) \]
      5. add-sqr-sqrt93.8%

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

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

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

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

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

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

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

Alternative 5: 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(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\sqrt{2} \cdot \frac{\ell}{k\_m}}{\sin k\_m}\right)}^{2}\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) t_m) (pow (/ (* (sqrt 2.0) (/ l k_m)) (sin k_m)) 2.0))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * ((cos(k_m) / t_m) * pow(((sqrt(2.0) * (l / k_m)) / sin(k_m)), 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 * ((cos(k_m) / t_m) * (((sqrt(2.0d0) * (l / k_m)) / sin(k_m)) ** 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.cos(k_m) / t_m) * Math.pow(((Math.sqrt(2.0) * (l / k_m)) / Math.sin(k_m)), 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.cos(k_m) / t_m) * math.pow(((math.sqrt(2.0) * (l / k_m)) / math.sin(k_m)), 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(cos(k_m) / t_m) * (Float64(Float64(sqrt(2.0) * Float64(l / k_m)) / sin(k_m)) ^ 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 * ((cos(k_m) / t_m) * (((sqrt(2.0) * (l / k_m)) / sin(k_m)) ^ 2.0));
end
k_m = N[Abs[k], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision] * N[Power[N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision] / N[Sin[k$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 \left(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\sqrt{2} \cdot \frac{\ell}{k\_m}}{\sin k\_m}\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 36.8%

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

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

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

      \[\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-rr27.6%

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

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

    \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
  8. Taylor expanded in l around 0 49.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. unpow-prod-down46.9%

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

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

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

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

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

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

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

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

Alternative 6: 93.1% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right)}^{2}\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) t_m) (pow (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) 2.0))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * ((cos(k_m) / t_m) * pow(((l / k_m) * (sqrt(2.0) / sin(k_m))), 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 * ((cos(k_m) / t_m) * (((l / k_m) * (sqrt(2.0d0) / sin(k_m))) ** 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.cos(k_m) / t_m) * Math.pow(((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))), 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.cos(k_m) / t_m) * math.pow(((l / k_m) * (math.sqrt(2.0) / math.sin(k_m))), 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(cos(k_m) / t_m) * (Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) ^ 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 * ((cos(k_m) / t_m) * (((l / k_m) * (sqrt(2.0) / sin(k_m))) ^ 2.0));
end
k_m = N[Abs[k], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision] * N[Power[N[(N[(l / k$95$m), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sin[k$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 \left(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 36.8%

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

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

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

      \[\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-rr27.6%

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

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

    \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
  8. Taylor expanded in l around 0 49.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. unpow-prod-down46.9%

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

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

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

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

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

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

Alternative 7: 74.7% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\sqrt{2}}{k\_m} \cdot \frac{\ell}{k\_m}\right)}^{2}\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) t_m) (pow (* (/ (sqrt 2.0) k_m) (/ l k_m)) 2.0))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	return t_s * ((cos(k_m) / t_m) * pow(((sqrt(2.0) / k_m) * (l / k_m)), 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 * ((cos(k_m) / t_m) * (((sqrt(2.0d0) / k_m) * (l / k_m)) ** 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.cos(k_m) / t_m) * Math.pow(((Math.sqrt(2.0) / k_m) * (l / k_m)), 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.cos(k_m) / t_m) * math.pow(((math.sqrt(2.0) / k_m) * (l / k_m)), 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(cos(k_m) / t_m) * (Float64(Float64(sqrt(2.0) / k_m) * Float64(l / k_m)) ^ 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 * ((cos(k_m) / t_m) * (((sqrt(2.0) / k_m) * (l / k_m)) ^ 2.0));
end
k_m = N[Abs[k], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k$95$m_] := N[(t$95$s * N[(N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision] * N[Power[N[(N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / k$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 \left(\frac{\cos k\_m}{t\_m} \cdot {\left(\frac{\sqrt{2}}{k\_m} \cdot \frac{\ell}{k\_m}\right)}^{2}\right)
\end{array}
Derivation
  1. Initial program 36.8%

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

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

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

      \[\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-rr27.6%

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

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

    \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\frac{\sqrt{\frac{2}{{t}^{3}}}}{\sqrt{\sin k \cdot \tan k}}}{\frac{k}{t}}\right)}^{2}} \]
  8. Taylor expanded in l around 0 49.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. unpow-prod-down46.9%

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

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

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

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

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

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

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

Alternative 8: 73.7% 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 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 73.5% 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 \left(\sqrt{\frac{2}{t\_m}} \cdot {k\_m}^{-2}\right)\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 \left(\sqrt{\frac{2}{t\_m}} \cdot {k\_m}^{-2}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 68.5% accurate, 1.9× speedup?

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

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 3.3 \cdot 10^{-146}:\\
\;\;\;\;\ell \cdot \left(\ell \cdot \left(\frac{2}{t\_m} \cdot {k\_m}^{-4}\right)\right)\\

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


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

    1. Initial program 40.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. Simplified44.4%

      \[\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 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3e-146 < k

    1. Initial program 30.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. Add Preprocessing
    3. Taylor expanded in t around 0 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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