Toniolo and Linder, Equation (10-)

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

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

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


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

    1. Initial program 40.2%

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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2000000000000001e-6 < k

    1. Initial program 29.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 40.2%

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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4500000000000001e-6 < k

    1. Initial program 29.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.1% accurate, 1.0× speedup?

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

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


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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt38.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000012e-9 < k

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

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

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

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

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

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

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

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


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

    1. Initial program 40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.00115 < k

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.1% accurate, 1.3× speedup?

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

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


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

    1. Initial program 40.5%

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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt37.8%

        \[\leadsto \frac{2}{\color{blue}{\sqrt{{k}^{2} \cdot \frac{{k}^{2} \cdot t}{{\ell}^{2}}} \cdot \sqrt{{k}^{2} \cdot \frac{{k}^{2} \cdot t}{{\ell}^{2}}}}} \]
      2. pow237.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7e-4 < k

    1. Initial program 28.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.1% accurate, 1.3× speedup?

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

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

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


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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt38.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6999999999999999e-9 < k

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

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

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

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

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

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

        \[\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. *-commutative74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
  8. Step-by-step derivation
    1. pow167.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt34.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{2}{{k}^{2} \cdot \color{blue}{\frac{{k}^{2} \cdot t}{{\ell}^{2}}}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt34.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 68.2% accurate, 3.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\\
t\_s \cdot \left(\left(\ell \cdot \ell\right) \cdot \frac{-0.11666666666666667}{t\_m}\right)
\end{array}
Derivation
  1. Initial program 37.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. Simplified43.5%

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

    \[\leadsto \color{blue}{\frac{{k}^{2} \cdot \left(-0.11666666666666667 \cdot \frac{{k}^{2}}{t} - 0.3333333333333333 \cdot \frac{1}{t}\right) + 2 \cdot \frac{1}{t}}{{k}^{4}}} \cdot \left(\ell \cdot \ell\right) \]
  5. Taylor expanded in k around inf 21.8%

    \[\leadsto \color{blue}{\frac{-0.11666666666666667}{t}} \cdot \left(\ell \cdot \ell\right) \]
  6. Final simplification21.8%

    \[\leadsto \left(\ell \cdot \ell\right) \cdot \frac{-0.11666666666666667}{t} \]
  7. Add Preprocessing

Reproduce

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