Toniolo and Linder, Equation (10-)

Percentage Accurate: 35.6% → 94.1%
Time: 24.7s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 35.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.49999999999999971e29 < k

    1. Initial program 42.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2}}}{t \cdot {\sin k}^{2}}} \]
    10. Step-by-step derivation
      1. associate-/l/75.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 95.6% accurate, 1.0× speedup?

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

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


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

    1. Initial program 19.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. Simplified35.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      2. rem-exp-log58.0%

        \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      3. exp-neg58.0%

        \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      4. exp-prod58.0%

        \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      5. distribute-lft-neg-out58.0%

        \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      6. distribute-rgt-neg-in58.0%

        \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      7. metadata-eval58.0%

        \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      8. exp-to-pow59.0%

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

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

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

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

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

    if 4.99999999999999998e-244 < (*.f64 l l)

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2}}}{t \cdot {\sin k}^{2}}} \]
    10. Step-by-step derivation
      1. associate-/l/78.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 95.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 19.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. Simplified35.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      2. rem-exp-log58.0%

        \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      3. exp-neg58.0%

        \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      4. exp-prod58.0%

        \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      5. distribute-lft-neg-out58.0%

        \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      6. distribute-rgt-neg-in58.0%

        \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      7. metadata-eval58.0%

        \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      8. exp-to-pow59.0%

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

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

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

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

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

    if 4.99999999999999998e-244 < (*.f64 l l)

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \frac{\frac{\color{blue}{\cos k \cdot {\ell}^{2}}}{{k}^{2}}}{t \cdot {\sin k}^{2}} \]
      2. *-un-lft-identity80.0%

        \[\leadsto 2 \cdot \frac{\frac{\cos k \cdot {\ell}^{2}}{\color{blue}{1 \cdot {k}^{2}}}}{t \cdot {\sin k}^{2}} \]
      3. times-frac80.0%

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

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

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

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

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

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

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

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

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

Alternative 4: 77.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    2. rem-exp-log46.0%

      \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    3. exp-neg45.9%

      \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    4. exp-prod45.9%

      \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    5. distribute-lft-neg-out45.9%

      \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    6. distribute-rgt-neg-in45.9%

      \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    7. metadata-eval45.9%

      \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    8. exp-to-pow46.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    2. rem-exp-log46.0%

      \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    3. exp-neg45.9%

      \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    4. exp-prod45.9%

      \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    5. distribute-lft-neg-out45.9%

      \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    6. distribute-rgt-neg-in45.9%

      \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    7. metadata-eval45.9%

      \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    8. exp-to-pow46.4%

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

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

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

Alternative 6: 78.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    2. rem-exp-log46.0%

      \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    3. exp-neg45.9%

      \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    4. exp-prod45.9%

      \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    5. distribute-lft-neg-out45.9%

      \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    6. distribute-rgt-neg-in45.9%

      \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    7. metadata-eval45.9%

      \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    8. exp-to-pow46.4%

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

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

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

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

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

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

Alternative 7: 75.9% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.5000000000000003e29 < k < 2.2999999999999999e156

    1. Initial program 34.6%

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

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

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

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

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

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

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

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

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

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

    if 2.2999999999999999e156 < k

    1. Initial program 50.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      2. rem-exp-log38.2%

        \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      3. exp-neg38.2%

        \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      4. exp-prod38.2%

        \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      5. distribute-lft-neg-out38.2%

        \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      6. distribute-rgt-neg-in38.2%

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

        \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
      8. exp-to-pow38.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.9% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\color{blue}{{\left(\frac{1}{t}\right)}^{0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    2. rem-exp-log46.0%

      \[\leadsto {\left({\left(\frac{1}{\color{blue}{e^{\log t}}}\right)}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    3. exp-neg45.9%

      \[\leadsto {\left({\color{blue}{\left(e^{-\log t}\right)}}^{0.5} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    4. exp-prod45.9%

      \[\leadsto {\left(\color{blue}{e^{\left(-\log t\right) \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    5. distribute-lft-neg-out45.9%

      \[\leadsto {\left(e^{\color{blue}{-\log t \cdot 0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    6. distribute-rgt-neg-in45.9%

      \[\leadsto {\left(e^{\color{blue}{\log t \cdot \left(-0.5\right)}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    7. metadata-eval45.9%

      \[\leadsto {\left(e^{\log t \cdot \color{blue}{-0.5}} \cdot \frac{\sqrt{2} \cdot \frac{\ell}{k}}{\sin k}\right)}^{2} \]
    8. exp-to-pow46.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 62.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{2 \cdot \frac{\frac{{\ell}^{2}}{{k}^{4}}}{t}} \]
  8. Final simplification63.7%

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

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

\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{2} \cdot -0.11666666666666667}{t\_m}\\


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

    1. Initial program 35.6%

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

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

      \[\leadsto \color{blue}{\frac{-0.11666666666666667}{t}} \cdot \left(\ell \cdot \ell\right) \]
    6. Step-by-step derivation
      1. add-sqr-sqrt4.7%

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

        \[\leadsto \color{blue}{\sqrt{\frac{-0.11666666666666667}{t} \cdot \frac{-0.11666666666666667}{t}}} \cdot \left(\ell \cdot \ell\right) \]
      3. pow225.9%

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

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

        \[\leadsto \sqrt{\color{blue}{\frac{-0.11666666666666667}{t} \cdot \frac{-0.11666666666666667}{t}}} \cdot \left(\ell \cdot \ell\right) \]
      2. rem-sqrt-square28.1%

        \[\leadsto \color{blue}{\left|\frac{-0.11666666666666667}{t}\right|} \cdot \left(\ell \cdot \ell\right) \]
    9. Simplified28.1%

      \[\leadsto \color{blue}{\left|\frac{-0.11666666666666667}{t}\right|} \cdot \left(\ell \cdot \ell\right) \]

    if 6.49999999999999971e29 < k

    1. Initial program 42.9%

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

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

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

      \[\leadsto \color{blue}{-0.11666666666666667 \cdot \frac{{\ell}^{2}}{t}} \]
    6. Step-by-step derivation
      1. *-commutative38.2%

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

        \[\leadsto \color{blue}{\frac{{\ell}^{2} \cdot -0.11666666666666667}{t}} \]
    7. Simplified38.2%

      \[\leadsto \color{blue}{\frac{{\ell}^{2} \cdot -0.11666666666666667}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.3%

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

Alternative 12: 62.6% accurate, 3.8× speedup?

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

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

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

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

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

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

Alternative 13: 20.8% accurate, 4.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{{\ell}^{2} \cdot -0.11666666666666667}{t\_m} \end{array} \]
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k_m)
 :precision binary64
 (* t_s (/ (* (pow l 2.0) -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 * ((pow(l, 2.0) * -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 ** 2.0d0) * (-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 * ((Math.pow(l, 2.0) * -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 * ((math.pow(l, 2.0) * -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 ^ 2.0) * -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 ^ 2.0) * -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[(N[Power[l, 2.0], $MachinePrecision] * -0.11666666666666667), $MachinePrecision] / t$95$m), $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{{\ell}^{2} \cdot -0.11666666666666667}{t\_m}
\end{array}
Derivation
  1. Initial program 37.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{\ell}^{2} \cdot -0.11666666666666667}{t}} \]
  7. Simplified19.5%

    \[\leadsto \color{blue}{\frac{{\ell}^{2} \cdot -0.11666666666666667}{t}} \]
  8. Final simplification19.5%

    \[\leadsto \frac{{\ell}^{2} \cdot -0.11666666666666667}{t} \]
  9. Add Preprocessing

Alternative 14: 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.2%

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

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

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

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

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

Reproduce

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