Toniolo and Linder, Equation (10-)

Percentage Accurate: 35.6% → 87.9%
Time: 17.8s
Alternatives: 21
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 21 alternatives:

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

Initial Program: 35.6% accurate, 1.0× speedup?

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

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

Alternative 1: 87.9% 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 := \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\ t_3 := {\left(\sqrt[3]{\ell}\right)}^{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 4.5 \cdot 10^{-24}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log 2 \cdot 0.5}}{{\left(t\_m \cdot \frac{t\_2}{t\_3}\right)}^{2} \cdot \frac{k\_m}{t\_m}} \cdot \frac{t\_m \cdot \frac{\sqrt{2}}{k\_m}}{t\_2 \cdot \frac{t\_m}{t\_3}}\\ \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 (cbrt (* (sin k_m) (tan k_m)))) (t_3 (pow (cbrt l) 2.0)))
   (*
    t_s
    (if (<= k_m 4.5e-24)
      (pow
       (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
       2.0)
      (*
       (/
        (exp (* (log 2.0) 0.5))
        (* (pow (* t_m (/ t_2 t_3)) 2.0) (/ k_m t_m)))
       (/ (* t_m (/ (sqrt 2.0) k_m)) (* t_2 (/ t_m t_3))))))))
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 = cbrt((sin(k_m) * tan(k_m)));
	double t_3 = pow(cbrt(l), 2.0);
	double tmp;
	if (k_m <= 4.5e-24) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else {
		tmp = (exp((log(2.0) * 0.5)) / (pow((t_m * (t_2 / t_3)), 2.0) * (k_m / t_m))) * ((t_m * (sqrt(2.0) / k_m)) / (t_2 * (t_m / t_3)));
	}
	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.cbrt((Math.sin(k_m) * Math.tan(k_m)));
	double t_3 = Math.pow(Math.cbrt(l), 2.0);
	double tmp;
	if (k_m <= 4.5e-24) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else {
		tmp = (Math.exp((Math.log(2.0) * 0.5)) / (Math.pow((t_m * (t_2 / t_3)), 2.0) * (k_m / t_m))) * ((t_m * (Math.sqrt(2.0) / k_m)) / (t_2 * (t_m / t_3)));
	}
	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 = cbrt(Float64(sin(k_m) * tan(k_m)))
	t_3 = cbrt(l) ^ 2.0
	tmp = 0.0
	if (k_m <= 4.5e-24)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	else
		tmp = Float64(Float64(exp(Float64(log(2.0) * 0.5)) / Float64((Float64(t_m * Float64(t_2 / t_3)) ^ 2.0) * Float64(k_m / t_m))) * Float64(Float64(t_m * Float64(sqrt(2.0) / k_m)) / Float64(t_2 * Float64(t_m / t_3))));
	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[Power[N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Power[l, 1/3], $MachinePrecision], 2.0], $MachinePrecision]}, N[(t$95$s * If[LessEqual[k$95$m, 4.5e-24], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / N[(N[Power[N[(t$95$m * N[(t$95$2 / t$95$3), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(t$95$m / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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


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

    1. Initial program 32.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. *-commutative32.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*32.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. Simplified37.7%

      \[\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. Applied egg-rr29.2%

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

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

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

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

    if 4.4999999999999997e-24 < k

    1. Initial program 23.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. *-commutative23.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*23.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. Simplified40.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{{\left(\frac{t}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k \cdot \tan k}\right)}^{2} \cdot \frac{k}{t}}} \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/81.6%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 82.5% 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 := \sin k\_m \cdot \tan k\_m\\ t_3 := t\_m \cdot {\left(\sqrt[3]{\ell}\right)}^{-2}\\ t_4 := \frac{\sqrt{2}}{k\_m}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 4.5 \cdot 10^{-24}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{elif}\;k\_m \leq 7.6 \cdot 10^{+158}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\frac{t\_m \cdot t\_4}{t\_2 \cdot {t\_3}^{3}}}{\frac{k\_m}{t\_m}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{\left(k\_m \cdot t\_m\right) \cdot \sqrt[3]{\frac{{\sin k\_m}^{4}}{{\ell}^{4} \cdot {\cos k\_m}^{2}}}} \cdot \left(\frac{t\_4}{t\_3} \cdot \frac{t\_m}{\sqrt[3]{t\_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 (* (sin k_m) (tan k_m)))
        (t_3 (* t_m (pow (cbrt l) -2.0)))
        (t_4 (/ (sqrt 2.0) k_m)))
   (*
    t_s
    (if (<= k_m 4.5e-24)
      (pow
       (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
       2.0)
      (if (<= k_m 7.6e+158)
        (* (sqrt 2.0) (/ (/ (* t_m t_4) (* t_2 (pow t_3 3.0))) (/ k_m t_m)))
        (*
         (/
          (sqrt 2.0)
          (*
           (* k_m t_m)
           (cbrt (/ (pow (sin k_m) 4.0) (* (pow l 4.0) (pow (cos k_m) 2.0))))))
         (* (/ t_4 t_3) (/ t_m (cbrt t_2)))))))))
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 = sin(k_m) * tan(k_m);
	double t_3 = t_m * pow(cbrt(l), -2.0);
	double t_4 = sqrt(2.0) / k_m;
	double tmp;
	if (k_m <= 4.5e-24) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else if (k_m <= 7.6e+158) {
		tmp = sqrt(2.0) * (((t_m * t_4) / (t_2 * pow(t_3, 3.0))) / (k_m / t_m));
	} else {
		tmp = (sqrt(2.0) / ((k_m * t_m) * cbrt((pow(sin(k_m), 4.0) / (pow(l, 4.0) * pow(cos(k_m), 2.0)))))) * ((t_4 / t_3) * (t_m / cbrt(t_2)));
	}
	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.sin(k_m) * Math.tan(k_m);
	double t_3 = t_m * Math.pow(Math.cbrt(l), -2.0);
	double t_4 = Math.sqrt(2.0) / k_m;
	double tmp;
	if (k_m <= 4.5e-24) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else if (k_m <= 7.6e+158) {
		tmp = Math.sqrt(2.0) * (((t_m * t_4) / (t_2 * Math.pow(t_3, 3.0))) / (k_m / t_m));
	} else {
		tmp = (Math.sqrt(2.0) / ((k_m * t_m) * Math.cbrt((Math.pow(Math.sin(k_m), 4.0) / (Math.pow(l, 4.0) * Math.pow(Math.cos(k_m), 2.0)))))) * ((t_4 / t_3) * (t_m / Math.cbrt(t_2)));
	}
	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(sin(k_m) * tan(k_m))
	t_3 = Float64(t_m * (cbrt(l) ^ -2.0))
	t_4 = Float64(sqrt(2.0) / k_m)
	tmp = 0.0
	if (k_m <= 4.5e-24)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	elseif (k_m <= 7.6e+158)
		tmp = Float64(sqrt(2.0) * Float64(Float64(Float64(t_m * t_4) / Float64(t_2 * (t_3 ^ 3.0))) / Float64(k_m / t_m)));
	else
		tmp = Float64(Float64(sqrt(2.0) / Float64(Float64(k_m * t_m) * cbrt(Float64((sin(k_m) ^ 4.0) / Float64((l ^ 4.0) * (cos(k_m) ^ 2.0)))))) * Float64(Float64(t_4 / t_3) * Float64(t_m / cbrt(t_2))));
	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[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$m * N[Power[N[Power[l, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k$95$m, 4.5e-24], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[k$95$m, 7.6e+158], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(N[(t$95$m * t$95$4), $MachinePrecision] / N[(t$95$2 * N[Power[t$95$3, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(k$95$m * t$95$m), $MachinePrecision] * N[Power[N[(N[Power[N[Sin[k$95$m], $MachinePrecision], 4.0], $MachinePrecision] / N[(N[Power[l, 4.0], $MachinePrecision] * N[Power[N[Cos[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$4 / t$95$3), $MachinePrecision] * N[(t$95$m / N[Power[t$95$2, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

\mathbf{elif}\;k\_m \leq 7.6 \cdot 10^{+158}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\frac{t\_m \cdot t\_4}{t\_2 \cdot {t\_3}^{3}}}{\frac{k\_m}{t\_m}}\\

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


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

    1. Initial program 32.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. *-commutative32.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*32.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. Simplified37.7%

      \[\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. Applied egg-rr29.2%

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

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

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

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

    if 4.4999999999999997e-24 < k < 7.5999999999999997e158

    1. Initial program 16.7%

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

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

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

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

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

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

        \[\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-rr85.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. associate-/l/85.6%

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{{\left(\frac{t}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k \cdot \tan k}\right)}^{2} \cdot \frac{k}{t}}} \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/85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5999999999999997e158 < k

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified52.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-sqrt52.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-cbrt52.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-frac52.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-rr75.5%

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{{\left(\frac{t}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k \cdot \tan k}\right)}^{2} \cdot \frac{k}{t}}} \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/75.6%

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

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

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

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

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

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

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

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

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

Alternative 3: 88.0% 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 := {\left(\sqrt[3]{\ell}\right)}^{2}\\ t_3 := \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-15}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_m \cdot \frac{\sqrt{2}}{k\_m}}{t\_3 \cdot \frac{t\_m}{t\_2}} \cdot \frac{\sqrt{2}}{\frac{k\_m}{t\_m} \cdot {\left(\frac{t\_m \cdot t\_3}{t\_2}\right)}^{2}}\\ \end{array} \end{array} \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (let* ((t_2 (pow (cbrt l) 2.0)) (t_3 (cbrt (* (sin k_m) (tan k_m)))))
   (*
    t_s
    (if (<= k_m 1.7e-15)
      (pow
       (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
       2.0)
      (*
       (/ (* t_m (/ (sqrt 2.0) k_m)) (* t_3 (/ t_m t_2)))
       (/ (sqrt 2.0) (* (/ k_m t_m) (pow (/ (* t_m t_3) t_2) 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 = pow(cbrt(l), 2.0);
	double t_3 = cbrt((sin(k_m) * tan(k_m)));
	double tmp;
	if (k_m <= 1.7e-15) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else {
		tmp = ((t_m * (sqrt(2.0) / k_m)) / (t_3 * (t_m / t_2))) * (sqrt(2.0) / ((k_m / t_m) * pow(((t_m * t_3) / t_2), 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.pow(Math.cbrt(l), 2.0);
	double t_3 = Math.cbrt((Math.sin(k_m) * Math.tan(k_m)));
	double tmp;
	if (k_m <= 1.7e-15) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else {
		tmp = ((t_m * (Math.sqrt(2.0) / k_m)) / (t_3 * (t_m / t_2))) * (Math.sqrt(2.0) / ((k_m / t_m) * Math.pow(((t_m * t_3) / t_2), 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 = cbrt(l) ^ 2.0
	t_3 = cbrt(Float64(sin(k_m) * tan(k_m)))
	tmp = 0.0
	if (k_m <= 1.7e-15)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	else
		tmp = Float64(Float64(Float64(t_m * Float64(sqrt(2.0) / k_m)) / Float64(t_3 * Float64(t_m / t_2))) * Float64(sqrt(2.0) / Float64(Float64(k_m / t_m) * (Float64(Float64(t_m * t_3) / t_2) ^ 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[Power[N[Power[l, 1/3], $MachinePrecision], 2.0], $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, 1.7e-15], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[(t$95$m / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(k$95$m / t$95$m), $MachinePrecision] * N[Power[N[(N[(t$95$m * t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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


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

    1. Initial program 32.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. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.2%

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

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

        \[\leadsto {\left(\color{blue}{\left(\frac{\ell}{k} \cdot \frac{\sqrt{2}}{\sin k}\right)} \cdot \sqrt{\frac{\cos k}{t}}\right)}^{2} \]
    8. Simplified51.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 1.7e-15 < k

    1. Initial program 22.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. *-commutative22.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*22.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. Simplified39.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{{\left(\frac{t}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k \cdot \tan k}\right)}^{2} \cdot \frac{k}{t}}} \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/80.7%

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

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

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

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

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

Alternative 4: 88.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 := {\left(\sqrt[3]{\ell}\right)}^{2}\\ t_3 := \sqrt[3]{\sin k\_m \cdot \tan k\_m}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 1.8 \cdot 10^{-12}:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_m \cdot \frac{\sqrt{2}}{k\_m}}{t\_3 \cdot \frac{t\_m}{t\_2}} \cdot \frac{\sqrt{2}}{{\left(t\_m \cdot \frac{t\_3}{t\_2}\right)}^{2} \cdot \frac{k\_m}{t\_m}}\\ \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 (pow (cbrt l) 2.0)) (t_3 (cbrt (* (sin k_m) (tan k_m)))))
   (*
    t_s
    (if (<= k_m 1.8e-12)
      (pow
       (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
       2.0)
      (*
       (/ (* t_m (/ (sqrt 2.0) k_m)) (* t_3 (/ t_m t_2)))
       (/ (sqrt 2.0) (* (pow (* t_m (/ t_3 t_2)) 2.0) (/ k_m 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 t_2 = pow(cbrt(l), 2.0);
	double t_3 = cbrt((sin(k_m) * tan(k_m)));
	double tmp;
	if (k_m <= 1.8e-12) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else {
		tmp = ((t_m * (sqrt(2.0) / k_m)) / (t_3 * (t_m / t_2))) * (sqrt(2.0) / (pow((t_m * (t_3 / t_2)), 2.0) * (k_m / t_m)));
	}
	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.pow(Math.cbrt(l), 2.0);
	double t_3 = Math.cbrt((Math.sin(k_m) * Math.tan(k_m)));
	double tmp;
	if (k_m <= 1.8e-12) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else {
		tmp = ((t_m * (Math.sqrt(2.0) / k_m)) / (t_3 * (t_m / t_2))) * (Math.sqrt(2.0) / (Math.pow((t_m * (t_3 / t_2)), 2.0) * (k_m / 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)
	t_2 = cbrt(l) ^ 2.0
	t_3 = cbrt(Float64(sin(k_m) * tan(k_m)))
	tmp = 0.0
	if (k_m <= 1.8e-12)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	else
		tmp = Float64(Float64(Float64(t_m * Float64(sqrt(2.0) / k_m)) / Float64(t_3 * Float64(t_m / t_2))) * Float64(sqrt(2.0) / Float64((Float64(t_m * Float64(t_3 / t_2)) ^ 2.0) * Float64(k_m / t_m))));
	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[Power[N[Power[l, 1/3], $MachinePrecision], 2.0], $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, 1.8e-12], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[(t$95$m / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[Power[N[(t$95$m * N[(t$95$3 / t$95$2), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(k$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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


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

    1. Initial program 32.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. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.2%

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

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

        \[\leadsto {\left(\color{blue}{\left(\frac{\ell}{k} \cdot \frac{\sqrt{2}}{\sin k}\right)} \cdot \sqrt{\frac{\cos k}{t}}\right)}^{2} \]
    8. Simplified51.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 1.8e-12 < k

    1. Initial program 22.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. *-commutative22.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*22.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. Simplified39.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{2}}{{\left(\frac{t}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k \cdot \tan k}\right)}^{2} \cdot \frac{k}{t}}} \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/80.7%

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

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

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

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

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

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

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

Alternative 5: 87.3% accurate, 0.6× 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 26.5:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{elif}\;k\_m \leq 6.5 \cdot 10^{+144}:\\ \;\;\;\;\frac{2}{\frac{{k\_m}^{2}}{{\ell}^{2}} \cdot \frac{t\_m \cdot {\sin k\_m}^{2}}{\cos k\_m}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{{\left(\frac{t\_m}{{\left(\sqrt[3]{\ell}\right)}^{2}} \cdot \sqrt[3]{\sin k\_m \cdot \left(\tan k\_m \cdot {\left(\frac{k\_m}{t\_m}\right)}^{2}\right)}\right)}^{3}}\\ \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 26.5)
    (pow
     (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
     2.0)
    (if (<= k_m 6.5e+144)
      (/
       2.0
       (*
        (/ (pow k_m 2.0) (pow l 2.0))
        (/ (* t_m (pow (sin k_m) 2.0)) (cos k_m))))
      (/
       2.0
       (pow
        (*
         (/ t_m (pow (cbrt l) 2.0))
         (cbrt (* (sin k_m) (* (tan k_m) (pow (/ k_m t_m) 2.0)))))
        3.0))))))
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k_m) {
	double tmp;
	if (k_m <= 26.5) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else if (k_m <= 6.5e+144) {
		tmp = 2.0 / ((pow(k_m, 2.0) / pow(l, 2.0)) * ((t_m * pow(sin(k_m), 2.0)) / cos(k_m)));
	} else {
		tmp = 2.0 / pow(((t_m / pow(cbrt(l), 2.0)) * cbrt((sin(k_m) * (tan(k_m) * pow((k_m / t_m), 2.0))))), 3.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 tmp;
	if (k_m <= 26.5) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else if (k_m <= 6.5e+144) {
		tmp = 2.0 / ((Math.pow(k_m, 2.0) / Math.pow(l, 2.0)) * ((t_m * Math.pow(Math.sin(k_m), 2.0)) / Math.cos(k_m)));
	} else {
		tmp = 2.0 / Math.pow(((t_m / Math.pow(Math.cbrt(l), 2.0)) * Math.cbrt((Math.sin(k_m) * (Math.tan(k_m) * Math.pow((k_m / t_m), 2.0))))), 3.0);
	}
	return t_s * tmp;
}
k_m = abs(k)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k_m)
	tmp = 0.0
	if (k_m <= 26.5)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	elseif (k_m <= 6.5e+144)
		tmp = Float64(2.0 / Float64(Float64((k_m ^ 2.0) / (l ^ 2.0)) * Float64(Float64(t_m * (sin(k_m) ^ 2.0)) / cos(k_m))));
	else
		tmp = Float64(2.0 / (Float64(Float64(t_m / (cbrt(l) ^ 2.0)) * cbrt(Float64(sin(k_m) * Float64(tan(k_m) * (Float64(k_m / t_m) ^ 2.0))))) ^ 3.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_] := N[(t$95$s * If[LessEqual[k$95$m, 26.5], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[k$95$m, 6.5e+144], N[(2.0 / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / N[Power[l, 2.0], $MachinePrecision]), $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], N[(2.0 / N[Power[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[(N[Tan[k$95$m], $MachinePrecision] * N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

\mathbf{elif}\;k\_m \leq 6.5 \cdot 10^{+144}:\\
\;\;\;\;\frac{2}{\frac{{k\_m}^{2}}{{\ell}^{2}} \cdot \frac{t\_m \cdot {\sin k\_m}^{2}}{\cos k\_m}}\\

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


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

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.1%

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

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

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

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

    if 26.5 < k < 6.50000000000000007e144

    1. Initial program 13.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. Simplified13.8%

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

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

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

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

    if 6.50000000000000007e144 < k

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

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

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

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

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

Alternative 6: 84.7% accurate, 0.8× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 26.5:\\ \;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{{k\_m}^{2}}{{\ell}^{2}} \cdot \frac{t\_m \cdot {\sin 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 26.5)
    (pow
     (* (* (/ l k_m) (/ (sqrt 2.0) (sin k_m))) (sqrt (/ (cos k_m) t_m)))
     2.0)
    (/
     2.0
     (*
      (/ (pow k_m 2.0) (pow l 2.0))
      (/ (* t_m (pow (sin 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 <= 26.5) {
		tmp = pow((((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))), 2.0);
	} else {
		tmp = 2.0 / ((pow(k_m, 2.0) / pow(l, 2.0)) * ((t_m * pow(sin(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 <= 26.5d0) then
        tmp = (((l / k_m) * (sqrt(2.0d0) / sin(k_m))) * sqrt((cos(k_m) / t_m))) ** 2.0d0
    else
        tmp = 2.0d0 / (((k_m ** 2.0d0) / (l ** 2.0d0)) * ((t_m * (sin(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 <= 26.5) {
		tmp = Math.pow((((l / k_m) * (Math.sqrt(2.0) / Math.sin(k_m))) * Math.sqrt((Math.cos(k_m) / t_m))), 2.0);
	} else {
		tmp = 2.0 / ((Math.pow(k_m, 2.0) / Math.pow(l, 2.0)) * ((t_m * Math.pow(Math.sin(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 <= 26.5:
		tmp = math.pow((((l / k_m) * (math.sqrt(2.0) / math.sin(k_m))) * math.sqrt((math.cos(k_m) / t_m))), 2.0)
	else:
		tmp = 2.0 / ((math.pow(k_m, 2.0) / math.pow(l, 2.0)) * ((t_m * math.pow(math.sin(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 <= 26.5)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(sqrt(2.0) / sin(k_m))) * sqrt(Float64(cos(k_m) / t_m))) ^ 2.0;
	else
		tmp = Float64(2.0 / Float64(Float64((k_m ^ 2.0) / (l ^ 2.0)) * Float64(Float64(t_m * (sin(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 <= 26.5)
		tmp = (((l / k_m) * (sqrt(2.0) / sin(k_m))) * sqrt((cos(k_m) / t_m))) ^ 2.0;
	else
		tmp = 2.0 / (((k_m ^ 2.0) / (l ^ 2.0)) * ((t_m * (sin(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, 26.5], 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[N[(N[Cos[k$95$m], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(2.0 / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / N[Power[l, 2.0], $MachinePrecision]), $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]
\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 26.5:\\
\;\;\;\;{\left(\left(\frac{\ell}{k\_m} \cdot \frac{\sqrt{2}}{\sin k\_m}\right) \cdot \sqrt{\frac{\cos k\_m}{t\_m}}\right)}^{2}\\

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


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

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.1%

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

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

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

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

    if 26.5 < k

    1. Initial program 21.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. Simplified21.4%

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

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

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

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

Alternative 7: 84.8% accurate, 0.8× speedup?

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

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


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

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.1%

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

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

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

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

    if 25 < k

    1. Initial program 21.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 32.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. Simplified32.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.94999999999999995e-41 < k

    1. Initial program 21.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. Simplified37.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 83.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 32.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. Simplified32.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.94999999999999995e-41 < k

    1. Initial program 21.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. Simplified37.7%

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

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

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

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

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

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

Alternative 10: 83.8% accurate, 1.0× speedup?

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

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


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

    1. Initial program 32.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. Simplified32.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8e-41 < k

    1. Initial program 21.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. Simplified37.7%

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

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

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

Alternative 11: 83.8% accurate, 1.0× speedup?

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

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


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

    1. Initial program 32.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. Simplified32.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.94999999999999995e-41 < k

    1. Initial program 21.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. Simplified37.7%

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

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

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

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

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

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

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

Alternative 12: 82.9% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 0.0004:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{{k\_m}^{2}} \cdot \sqrt{\frac{1}{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{{k\_m}^{2} \cdot \frac{t\_m \cdot \frac{1 - \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 0.0004)
    (pow (* (/ (* l (sqrt 2.0)) (pow k_m 2.0)) (sqrt (/ 1.0 t_m))) 2.0)
    (*
     (* l l)
     (/
      2.0
      (*
       (pow k_m 2.0)
       (/ (* t_m (/ (- 1.0 (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 <= 0.0004) {
		tmp = pow((((l * sqrt(2.0)) / pow(k_m, 2.0)) * sqrt((1.0 / t_m))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / (pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.0004d0) then
        tmp = (((l * sqrt(2.0d0)) / (k_m ** 2.0d0)) * sqrt((1.0d0 / t_m))) ** 2.0d0
    else
        tmp = (l * l) * (2.0d0 / ((k_m ** 2.0d0) * ((t_m * ((1.0d0 - 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 <= 0.0004) {
		tmp = Math.pow((((l * Math.sqrt(2.0)) / Math.pow(k_m, 2.0)) * Math.sqrt((1.0 / t_m))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / (Math.pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.0004:
		tmp = math.pow((((l * math.sqrt(2.0)) / math.pow(k_m, 2.0)) * math.sqrt((1.0 / t_m))), 2.0)
	else:
		tmp = (l * l) * (2.0 / (math.pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.0004)
		tmp = Float64(Float64(Float64(l * sqrt(2.0)) / (k_m ^ 2.0)) * sqrt(Float64(1.0 / t_m))) ^ 2.0;
	else
		tmp = Float64(Float64(l * l) * Float64(2.0 / Float64((k_m ^ 2.0) * Float64(Float64(t_m * Float64(Float64(1.0 - 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 <= 0.0004)
		tmp = (((l * sqrt(2.0)) / (k_m ^ 2.0)) * sqrt((1.0 / t_m))) ^ 2.0;
	else
		tmp = (l * l) * (2.0 / ((k_m ^ 2.0) * ((t_m * ((1.0 - 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, 0.0004], 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], N[(N[(l * l), $MachinePrecision] * N[(2.0 / N[(N[Power[k$95$m, 2.0], $MachinePrecision] * N[(N[(t$95$m * N[(N[(1.0 - N[Cos[N[(k$95$m * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 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 0.0004:\\
\;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{{k\_m}^{2}} \cdot \sqrt{\frac{1}{t\_m}}\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{{k\_m}^{2} \cdot \frac{t\_m \cdot \frac{1 - \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 < 4.00000000000000019e-4

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.1%

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

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

    if 4.00000000000000019e-4 < k

    1. Initial program 21.4%

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

        \[\leadsto \frac{2}{\color{blue}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \cdot \left(\ell \cdot \ell\right) \]
    6. Simplified66.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. unpow266.4%

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

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

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

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

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

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

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

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

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

Alternative 13: 82.9% accurate, 1.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k\_m \leq 0.00045:\\ \;\;\;\;{\left(\frac{\sqrt{2}}{\frac{{k\_m}^{2}}{\ell} \cdot \sqrt{t\_m}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{{k\_m}^{2} \cdot \frac{t\_m \cdot \frac{1 - \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 0.00045)
    (pow (/ (sqrt 2.0) (* (/ (pow k_m 2.0) l) (sqrt t_m))) 2.0)
    (*
     (* l l)
     (/
      2.0
      (*
       (pow k_m 2.0)
       (/ (* t_m (/ (- 1.0 (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 <= 0.00045) {
		tmp = pow((sqrt(2.0) / ((pow(k_m, 2.0) / l) * sqrt(t_m))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / (pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.00045d0) then
        tmp = (sqrt(2.0d0) / (((k_m ** 2.0d0) / l) * sqrt(t_m))) ** 2.0d0
    else
        tmp = (l * l) * (2.0d0 / ((k_m ** 2.0d0) * ((t_m * ((1.0d0 - 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 <= 0.00045) {
		tmp = Math.pow((Math.sqrt(2.0) / ((Math.pow(k_m, 2.0) / l) * Math.sqrt(t_m))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / (Math.pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.00045:
		tmp = math.pow((math.sqrt(2.0) / ((math.pow(k_m, 2.0) / l) * math.sqrt(t_m))), 2.0)
	else:
		tmp = (l * l) * (2.0 / (math.pow(k_m, 2.0) * ((t_m * ((1.0 - 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 <= 0.00045)
		tmp = Float64(sqrt(2.0) / Float64(Float64((k_m ^ 2.0) / l) * sqrt(t_m))) ^ 2.0;
	else
		tmp = Float64(Float64(l * l) * Float64(2.0 / Float64((k_m ^ 2.0) * Float64(Float64(t_m * Float64(Float64(1.0 - 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 <= 0.00045)
		tmp = (sqrt(2.0) / (((k_m ^ 2.0) / l) * sqrt(t_m))) ^ 2.0;
	else
		tmp = (l * l) * (2.0 / ((k_m ^ 2.0) * ((t_m * ((1.0 - 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, 0.00045], N[Power[N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(l * l), $MachinePrecision] * N[(2.0 / N[(N[Power[k$95$m, 2.0], $MachinePrecision] * N[(N[(t$95$m * N[(N[(1.0 - N[Cos[N[(k$95$m * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 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 0.00045:\\
\;\;\;\;{\left(\frac{\sqrt{2}}{\frac{{k\_m}^{2}}{\ell} \cdot \sqrt{t\_m}}\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{{k\_m}^{2} \cdot \frac{t\_m \cdot \frac{1 - \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 < 4.4999999999999999e-4

    1. Initial program 32.4%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative32.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*32.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. Simplified38.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. Applied egg-rr29.1%

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

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

    if 4.4999999999999999e-4 < k

    1. Initial program 21.4%

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

        \[\leadsto \frac{2}{\color{blue}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \cdot \left(\ell \cdot \ell\right) \]
    6. Simplified66.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. unpow266.4%

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

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

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

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

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

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

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

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

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

Alternative 14: 81.9% accurate, 1.3× speedup?

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

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


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

    1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

    if 3.4000000000000002e-47 < k

    1. Initial program 22.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. Simplified38.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 71.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*71.5%

        \[\leadsto \frac{2}{\color{blue}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}} \cdot \left(\ell \cdot \ell\right) \]
    6. Simplified71.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. unpow271.5%

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

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

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

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

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


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

    1. Initial program 32.7%

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

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

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

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

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

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

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

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

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

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

    if 3.4000000000000002e-47 < k

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 65.5% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 27.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. Simplified27.8%

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

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

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

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

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

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

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

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

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

    if 9.40000000000000004e-119 < l

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

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

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

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

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

Alternative 18: 63.6% accurate, 2.0× speedup?

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

\\
t\_s \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(2 \cdot \frac{\cos k\_m}{t\_m \cdot {k\_m}^{4}}\right)\right)
\end{array}
Derivation
  1. Initial program 29.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. Simplified37.7%

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

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

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

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

Alternative 19: 62.4% accurate, 2.0× speedup?

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

\\
t\_s \cdot \left(\frac{2}{t\_m} \cdot \frac{{\ell}^{2}}{{k\_m}^{4}}\right)
\end{array}
Derivation
  1. Initial program 29.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. Simplified37.7%

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

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

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

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

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

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

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

Alternative 20: 62.3% 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 29.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. Simplified37.7%

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

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

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

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

\\
t\_s \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(\frac{2}{t\_m} \cdot {k\_m}^{-4}\right)\right)
\end{array}
Derivation
  1. Initial program 29.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. Simplified37.7%

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

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

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

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

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

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

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

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

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

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

Reproduce

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