Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.0% → 89.3%
Time: 27.1s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 36.0% 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: 89.3% accurate, 0.3× 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{\sqrt{2}}{\frac{k\_m}{t\_m}}\\ t_3 := \frac{\cos k\_m}{t\_m}\\ t_4 := \frac{t\_m}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-19}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{t\_3}\right)}^{2}\\ \mathbf{elif}\;k\_m \leq 3.1 \cdot 10^{+152}:\\ \;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{t\_3}{{\sin k\_m}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_2}{{t\_4}^{2}} \cdot \frac{t\_2}{t\_4}\\ \end{array} \end{array} \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (let* ((t_2 (/ (sqrt 2.0) (/ k_m t_m)))
        (t_3 (/ (cos k_m) t_m))
        (t_4 (* (/ t_m (pow (cbrt l) 2.0)) (cbrt (* (sin k_m) (tan k_m))))))
   (*
    t_s
    (if (<= k_m 5.8e-19)
      (pow (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt t_3)) 2.0)
      (if (<= k_m 3.1e+152)
        (* (/ (pow l 2.0) (pow k_m 2.0)) (* 2.0 (/ t_3 (pow (sin k_m) 2.0))))
        (* (/ t_2 (pow t_4 2.0)) (/ t_2 t_4)))))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double t_2 = sqrt(2.0) / (k_m / t_m);
	double t_3 = cos(k_m) / t_m;
	double t_4 = (t_m / pow(cbrt(l), 2.0)) * cbrt((sin(k_m) * tan(k_m)));
	double tmp;
	if (k_m <= 5.8e-19) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt(t_3)), 2.0);
	} else if (k_m <= 3.1e+152) {
		tmp = (pow(l, 2.0) / pow(k_m, 2.0)) * (2.0 * (t_3 / pow(sin(k_m), 2.0)));
	} else {
		tmp = (t_2 / pow(t_4, 2.0)) * (t_2 / t_4);
	}
	return t_s * tmp;
}
k_m = Math.abs(k);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k_m) {
	double t_2 = Math.sqrt(2.0) / (k_m / t_m);
	double t_3 = Math.cos(k_m) / t_m;
	double t_4 = (t_m / Math.pow(Math.cbrt(l), 2.0)) * Math.cbrt((Math.sin(k_m) * Math.tan(k_m)));
	double tmp;
	if (k_m <= 5.8e-19) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt(t_3)), 2.0);
	} else if (k_m <= 3.1e+152) {
		tmp = (Math.pow(l, 2.0) / Math.pow(k_m, 2.0)) * (2.0 * (t_3 / Math.pow(Math.sin(k_m), 2.0)));
	} else {
		tmp = (t_2 / Math.pow(t_4, 2.0)) * (t_2 / t_4);
	}
	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(sqrt(2.0) / Float64(k_m / t_m))
	t_3 = Float64(cos(k_m) / t_m)
	t_4 = Float64(Float64(t_m / (cbrt(l) ^ 2.0)) * cbrt(Float64(sin(k_m) * tan(k_m))))
	tmp = 0.0
	if (k_m <= 5.8e-19)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(t_3)) ^ 2.0;
	elseif (k_m <= 3.1e+152)
		tmp = Float64(Float64((l ^ 2.0) / (k_m ^ 2.0)) * Float64(2.0 * Float64(t_3 / (sin(k_m) ^ 2.0))));
	else
		tmp = Float64(Float64(t_2 / (t_4 ^ 2.0)) * Float64(t_2 / t_4));
	end
	return Float64(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[Sqrt[2.0], $MachinePrecision] / N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$m / N[Power[N[Power[l, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k$95$m, 5.8e-19], N[Power[N[(N[(N[(l / k$95$m), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[k$95$m, 3.1e+152], N[(N[(N[Power[l, 2.0], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(t$95$3 / N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 / t$95$4), $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{\sqrt{2}}{\frac{k\_m}{t\_m}}\\
t_3 := \frac{\cos k\_m}{t\_m}\\
t_4 := \frac{t\_m}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-19}:\\
\;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{t\_3}\right)}^{2}\\

\mathbf{elif}\;k\_m \leq 3.1 \cdot 10^{+152}:\\
\;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{t\_3}{{\sin k\_m}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{{t\_4}^{2}} \cdot \frac{t\_2}{t\_4}\\


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

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8e-19 < k < 3.1e152

    1. Initial program 16.2%

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

      \[\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 t around 0 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.1e152 < k

    1. Initial program 40.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 89.1% accurate, 0.3× 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_3 := \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-19}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{t\_2}\right)}^{2}\\ \mathbf{elif}\;k\_m \leq 3.7 \cdot 10^{+152}:\\ \;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{t\_2}{{\sin k\_m}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{2}}{\frac{k\_m}{t\_m}}}{\frac{t\_m}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot t\_3} \cdot \left(\left(t\_m \cdot \frac{\sqrt{2}}{k\_m}\right) \cdot {\left(t\_3 \cdot \left(t\_m \cdot {\left(\sqrt[3]{\ell}\right)}^{-2}\right)\right)}^{-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_3 (cbrt (* (sin k_m) (tan k_m)))))
   (*
    t_s
    (if (<= k_m 5.8e-19)
      (pow (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt t_2)) 2.0)
      (if (<= k_m 3.7e+152)
        (* (/ (pow l 2.0) (pow k_m 2.0)) (* 2.0 (/ t_2 (pow (sin k_m) 2.0))))
        (*
         (/ (/ (sqrt 2.0) (/ k_m t_m)) (* (/ t_m (pow (cbrt l) 2.0)) t_3))
         (*
          (* t_m (/ (sqrt 2.0) k_m))
          (pow (* t_3 (* t_m (pow (cbrt l) -2.0))) -2.0))))))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double t_2 = cos(k_m) / t_m;
	double t_3 = cbrt((sin(k_m) * tan(k_m)));
	double tmp;
	if (k_m <= 5.8e-19) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt(t_2)), 2.0);
	} else if (k_m <= 3.7e+152) {
		tmp = (pow(l, 2.0) / pow(k_m, 2.0)) * (2.0 * (t_2 / pow(sin(k_m), 2.0)));
	} else {
		tmp = ((sqrt(2.0) / (k_m / t_m)) / ((t_m / pow(cbrt(l), 2.0)) * t_3)) * ((t_m * (sqrt(2.0) / k_m)) * pow((t_3 * (t_m * pow(cbrt(l), -2.0))), -2.0));
	}
	return t_s * tmp;
}
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 t_3 = Math.cbrt((Math.sin(k_m) * Math.tan(k_m)));
	double tmp;
	if (k_m <= 5.8e-19) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt(t_2)), 2.0);
	} else if (k_m <= 3.7e+152) {
		tmp = (Math.pow(l, 2.0) / Math.pow(k_m, 2.0)) * (2.0 * (t_2 / Math.pow(Math.sin(k_m), 2.0)));
	} else {
		tmp = ((Math.sqrt(2.0) / (k_m / t_m)) / ((t_m / Math.pow(Math.cbrt(l), 2.0)) * t_3)) * ((t_m * (Math.sqrt(2.0) / k_m)) * Math.pow((t_3 * (t_m * Math.pow(Math.cbrt(l), -2.0))), -2.0));
	}
	return t_s * tmp;
}
k_m = abs(k)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	t_2 = Float64(cos(k_m) / t_m)
	t_3 = cbrt(Float64(sin(k_m) * tan(k_m)))
	tmp = 0.0
	if (k_m <= 5.8e-19)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(t_2)) ^ 2.0;
	elseif (k_m <= 3.7e+152)
		tmp = Float64(Float64((l ^ 2.0) / (k_m ^ 2.0)) * Float64(2.0 * Float64(t_2 / (sin(k_m) ^ 2.0))));
	else
		tmp = Float64(Float64(Float64(sqrt(2.0) / Float64(k_m / t_m)) / Float64(Float64(t_m / (cbrt(l) ^ 2.0)) * t_3)) * Float64(Float64(t_m * Float64(sqrt(2.0) / k_m)) * (Float64(t_3 * Float64(t_m * (cbrt(l) ^ -2.0))) ^ -2.0)));
	end
	return Float64(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]}, Block[{t$95$3 = N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(t$95$s * If[LessEqual[k$95$m, 5.8e-19], N[Power[N[(N[(N[(l / k$95$m), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[k$95$m, 3.7e+152], N[(N[(N[Power[l, 2.0], $MachinePrecision] / N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(t$95$2 / N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] / N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$m / N[Power[N[Power[l, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision] * N[Power[N[(t$95$3 * N[(t$95$m * N[Power[N[Power[l, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \frac{\cos k\_m}{t\_m}\\
t_3 := \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-19}:\\
\;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{t\_2}\right)}^{2}\\

\mathbf{elif}\;k\_m \leq 3.7 \cdot 10^{+152}:\\
\;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{t\_2}{{\sin k\_m}^{2}}\right)\\

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


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

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8e-19 < k < 3.69999999999999996e152

    1. Initial program 16.2%

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

      \[\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 t around 0 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.69999999999999996e152 < k

    1. Initial program 40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;2 \cdot \left(\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \frac{\cos k\_m}{t\_m \cdot {\sin k\_m}^{2}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 2.0000000000000001e-219

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-219 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 42.8%

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{\frac{\cos k\_m}{t\_m}}{{\sin k\_m}^{2}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 2.0000000000000001e-219

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-219 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 42.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\frac{{\ell}^{2}}{{k\_m}^{2}} \cdot \left(2 \cdot \frac{\frac{\cos k\_m}{t\_m}}{{\sin k\_m}^{2}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 2.0000000000000001e-219

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-219 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 42.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{{k\_m}^{2} \cdot \frac{t\_m \cdot {\sin k\_m}^{2}}{\cos k\_m}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 2.0000000000000001e-219

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-219 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 42.8%

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

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

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

Alternative 7: 85.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{\frac{{\sin k\_m}^{2} \cdot \left(t\_m \cdot {k\_m}^{2}\right)}{\cos k\_m}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 2.0000000000000001e-219

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-219 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 42.8%

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

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

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

Alternative 8: 82.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{\frac{2}{t\_m \cdot {k\_m}^{2}}}{\frac{0.5 - \frac{\cos \left(k\_m \cdot 2\right)}{2}}{\cos k\_m}}\\

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


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

    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. Step-by-step derivation
      1. *-commutative27.1%

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

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

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

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

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

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

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

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

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

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

    if 2e-176 < (*.f64 l l) < 2.0000000000000001e300

    1. Initial program 45.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{2}{{k}^{2} \cdot t}}{\frac{\color{blue}{0.5} - \frac{\cos \left(k + k\right)}{2}}{\cos k}} \cdot \left(\ell \cdot \ell\right) \]
      5. count-282.6%

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

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

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

    if 2.0000000000000001e300 < (*.f64 l l)

    1. Initial program 40.2%

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

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt28.4%

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

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

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

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

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

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

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

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

Alternative 9: 84.0% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 41.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. Add Preprocessing
    3. Applied egg-rr17.9%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt25.9%

        \[\leadsto \frac{2}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \color{blue}{0}} \]
      2. +-rgt-identity25.9%

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

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

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

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

    if 3.40000000000000006e-6 < k

    1. Initial program 29.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified37.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. Taylor expanded in t around 0 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{2}{{k}^{2} \cdot t}}{\frac{\color{blue}{\frac{\cos \left(k - k\right) - \cos \left(k + k\right)}{2}}}{\cos k}} \cdot \left(\ell \cdot \ell\right) \]
    12. Applied egg-rr65.7%

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

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

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

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

        \[\leadsto \frac{\frac{2}{{k}^{2} \cdot t}}{\frac{\color{blue}{0.5} - \frac{\cos \left(k + k\right)}{2}}{\cos k}} \cdot \left(\ell \cdot \ell\right) \]
      5. count-265.7%

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

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

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

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

Alternative 10: 76.1% accurate, 1.3× speedup?

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

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


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

    1. Initial program 41.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. Add Preprocessing
    3. Applied egg-rr17.9%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt25.9%

        \[\leadsto \frac{2}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \color{blue}{0}} \]
      2. +-rgt-identity25.9%

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

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

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

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

    if 3.40000000000000006e-6 < k

    1. Initial program 29.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified37.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. Taylor expanded in t around 0 65.7%

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

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

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

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

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

Alternative 11: 76.2% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 41.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. Add Preprocessing
    3. Applied egg-rr17.9%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt25.9%

        \[\leadsto \frac{2}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \color{blue}{0}} \]
      2. +-rgt-identity25.9%

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

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

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

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

    if 3.40000000000000006e-6 < k

    1. Initial program 29.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified37.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. Taylor expanded in t around 0 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 75.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(\sqrt{t\_m} \cdot \frac{{k\_m}^{2}}{\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 (* (sqrt t_m) (/ (pow k_m 2.0) 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((sqrt(t_m) * (pow(k_m, 2.0) / 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 / ((sqrt(t_m) * ((k_m ** 2.0d0) / 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.sqrt(t_m) * (Math.pow(k_m, 2.0) / 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.sqrt(t_m) * (math.pow(k_m, 2.0) / 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(sqrt(t_m) * Float64((k_m ^ 2.0) / 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 / ((sqrt(t_m) * ((k_m ^ 2.0) / 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[Sqrt[t$95$m], $MachinePrecision] * N[(N[Power[k$95$m, 2.0], $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(\sqrt{t\_m} \cdot \frac{{k\_m}^{2}}{\ell}\right)}^{2}}
\end{array}
Derivation
  1. Initial program 38.1%

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

    \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
  4. Step-by-step derivation
    1. mul0-rgt23.1%

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

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

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

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

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

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

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

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 0:\\
\;\;\;\;\frac{2}{{\left(k\_m \cdot \left(\frac{k\_m}{t\_m} \cdot \frac{{t\_m}^{1.5}}{\ell}\right)\right)}^{2}}\\

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


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

    1. Initial program 25.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. Applied egg-rr0.0%

      \[\leadsto \frac{2}{\color{blue}{{\left(\frac{k}{t} \cdot \left(\frac{{t}^{1.5}}{\ell} \cdot \sqrt{\sin k \cdot \tan k}\right)\right)}^{2} + \left(\sin k \cdot \left(\tan k \cdot \left({t}^{3} \cdot {\ell}^{-2}\right)\right)\right) \cdot 0}} \]
    4. Step-by-step derivation
      1. mul0-rgt13.2%

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

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

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

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

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

    if 0.0 < (*.f64 l l)

    1. Initial program 41.3%

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 63.3% accurate, 2.0× speedup?

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
  6. Simplified62.5%

    \[\leadsto \color{blue}{2 \cdot \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
  7. Step-by-step derivation
    1. *-un-lft-identity62.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 63.4% 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(\left(\ell \cdot \ell\right) \cdot \frac{2}{t\_m \cdot {k\_m}^{4}}\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(Float64(l * l) * Float64(2.0 / Float64(t_m * (k_m ^ 4.0)))))
end
k_m = abs(k);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k_m)
	tmp = t_s * ((l * 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[(N[(l * l), $MachinePrecision] * N[(2.0 / N[(t$95$m * N[Power[k$95$m, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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

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

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

Reproduce

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