Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.4% → 92.2%
Time: 8.4s
Alternatives: 12
Speedup: 4.4×

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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(t, l, k)
use fmin_fmax_functions
    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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 36.4% 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(t, l, k)
use fmin_fmax_functions
    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: 92.2% accurate, 1.2× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} t_1 := \cos \left(k\_m + k\_m\right)\\ \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{elif}\;k\_m \leq 1.25 \cdot 10^{+203}:\\ \;\;\;\;\frac{\frac{\left(\ell + \ell\right) \cdot \cos k\_m}{k\_m} \cdot \frac{\ell}{\mathsf{fma}\left(t\_1, -0.5, 0.5\right) \cdot t}}{k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos k\_m \cdot \ell}{k\_m} \cdot \frac{\ell + \ell}{k\_m}}{\left(0.5 - 0.5 \cdot t\_1\right) \cdot t}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (let* ((t_1 (cos (+ k_m k_m))))
   (if (<= k_m 8.5e-6)
     (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
     (if (<= k_m 1.25e+203)
       (/ (* (/ (* (+ l l) (cos k_m)) k_m) (/ l (* (fma t_1 -0.5 0.5) t))) k_m)
       (/
        (* (/ (* (cos k_m) l) k_m) (/ (+ l l) k_m))
        (* (- 0.5 (* 0.5 t_1)) t))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double t_1 = cos((k_m + k_m));
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else if (k_m <= 1.25e+203) {
		tmp = ((((l + l) * cos(k_m)) / k_m) * (l / (fma(t_1, -0.5, 0.5) * t))) / k_m;
	} else {
		tmp = (((cos(k_m) * l) / k_m) * ((l + l) / k_m)) / ((0.5 - (0.5 * t_1)) * t);
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	t_1 = cos(Float64(k_m + k_m))
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	elseif (k_m <= 1.25e+203)
		tmp = Float64(Float64(Float64(Float64(Float64(l + l) * cos(k_m)) / k_m) * Float64(l / Float64(fma(t_1, -0.5, 0.5) * t))) / k_m);
	else
		tmp = Float64(Float64(Float64(Float64(cos(k_m) * l) / k_m) * Float64(Float64(l + l) / k_m)) / Float64(Float64(0.5 - Float64(0.5 * t_1)) * t));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k$95$m, 1.25e+203], N[(N[(N[(N[(N[(l + l), $MachinePrecision] * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(t$95$1 * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision], N[(N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(N[(l + l), $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(0.5 - N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
t_1 := \cos \left(k\_m + k\_m\right)\\
\mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\

\mathbf{elif}\;k\_m \leq 1.25 \cdot 10^{+203}:\\
\;\;\;\;\frac{\frac{\left(\ell + \ell\right) \cdot \cos k\_m}{k\_m} \cdot \frac{\ell}{\mathsf{fma}\left(t\_1, -0.5, 0.5\right) \cdot t}}{k\_m}\\

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


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k < 1.24999999999999999e203

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

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

      \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), 0.5, -0.5\right) \cdot t}}{\color{blue}{k}} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t}}{k} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t}}{k} \]
      3. frac-2negN/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{1}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      5. mult-flip-revN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\cos \left(k + k\right) \cdot \frac{1}{2} + \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} + \cos \left(k + k\right) \cdot \frac{1}{2}\right)\right)\right) \cdot t}}{k} \]
      10. add-flipN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \left(\mathsf{neg}\left(\cos \left(k + k\right) \cdot \frac{1}{2}\right)\right)\right)\right)\right) \cdot t}}{k} \]
      11. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \cos \left(k + k\right) \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)\right) \cdot t}}{k} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \cos \left(k + k\right) \cdot \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      13. sub-negate-revN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} - \frac{-1}{2}\right) \cdot t}}{k} \]
      14. metadata-evalN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right) \cdot t}}{k} \]
      15. add-flipN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} + \frac{1}{2}\right) \cdot t}}{k} \]
      16. lift-fma.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t}}{k} \]
    9. Applied rewrites83.1%

      \[\leadsto \frac{\frac{\left(\ell + \ell\right) \cdot \cos k}{k} \cdot \frac{\ell}{\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t}}{k} \]

    if 1.24999999999999999e203 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-/.f64N/A

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

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

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

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

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

      \[\leadsto \frac{\frac{\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot 2}{k \cdot k}}{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\frac{\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot 2}{k \cdot k}}{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right)} \cdot t} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot 2}{k \cdot k}}{\left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot 2}{k \cdot k}}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      4. associate-*l*N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \left(\ell \cdot 2\right)}{k \cdot k}}{\left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \left(\ell \cdot 2\right)}{k \cdot k}}{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(k + k\right)}\right) \cdot t} \]
      6. times-fracN/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell \cdot 2}{k}}{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right)} \cdot t} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell \cdot 2}{k}}{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right)} \cdot t} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell \cdot 2}{k}}{\left(\color{blue}{\frac{1}{2}} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell \cdot 2}{k}}{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(k + k\right)}\right) \cdot t} \]
      10. *-commutativeN/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{2 \cdot \ell}{k}}{\left(\frac{1}{2} - \color{blue}{\frac{1}{2}} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      11. count-2-revN/A

        \[\leadsto \frac{\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell + \ell}{k}}{\left(\frac{1}{2} - \color{blue}{\frac{1}{2}} \cdot \cos \left(k + k\right)\right) \cdot t} \]
      12. lower-+.f6483.1

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

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

Alternative 2: 92.1% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\ell + \ell\right) \cdot \cos k\_m}{k\_m} \cdot \frac{\ell}{\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t}}{k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (/
    (*
     (/ (* (+ l l) (cos k_m)) k_m)
     (/ l (* (fma (cos (+ k_m k_m)) -0.5 0.5) t)))
    k_m)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = ((((l + l) * cos(k_m)) / k_m) * (l / (fma(cos((k_m + k_m)), -0.5, 0.5) * t))) / k_m;
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(l + l) * cos(k_m)) / k_m) * Float64(l / Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t))) / k_m);
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(l + l), $MachinePrecision] * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\ell + \ell\right) \cdot \cos k\_m}{k\_m} \cdot \frac{\ell}{\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t}}{k\_m}\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

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

      \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), 0.5, -0.5\right) \cdot t}}{\color{blue}{k}} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t}}{k} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{-1}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t}}{k} \]
      3. frac-2negN/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\left(\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}\right) \cdot \frac{1}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      5. mult-flip-revN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right) \cdot t\right)}}{k} \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{1}{2}, \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\cos \left(k + k\right) \cdot \frac{1}{2} + \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} + \cos \left(k + k\right) \cdot \frac{1}{2}\right)\right)\right) \cdot t}}{k} \]
      10. add-flipN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \left(\mathsf{neg}\left(\cos \left(k + k\right) \cdot \frac{1}{2}\right)\right)\right)\right)\right) \cdot t}}{k} \]
      11. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \cos \left(k + k\right) \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)\right) \cdot t}}{k} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\mathsf{neg}\left(\left(\frac{-1}{2} - \cos \left(k + k\right) \cdot \frac{-1}{2}\right)\right)\right) \cdot t}}{k} \]
      13. sub-negate-revN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} - \frac{-1}{2}\right) \cdot t}}{k} \]
      14. metadata-evalN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right) \cdot t}}{k} \]
      15. add-flipN/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\left(\cos \left(k + k\right) \cdot \frac{-1}{2} + \frac{1}{2}\right) \cdot t}}{k} \]
      16. lift-fma.f64N/A

        \[\leadsto \frac{\frac{\left(\cos k \cdot \ell\right) \cdot \frac{\ell + \ell}{k}}{\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t}}{k} \]
    9. Applied rewrites83.1%

      \[\leadsto \frac{\frac{\left(\ell + \ell\right) \cdot \cos k}{k} \cdot \frac{\ell}{\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t}}{k} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 91.4% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell + \ell}{k\_m} \cdot \left(\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m} \cdot \cos k\_m\right)\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (*
    (/ (+ l l) k_m)
    (* (/ l (* (* (fma (cos (+ k_m k_m)) -0.5 0.5) t) k_m)) (cos k_m)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = ((l + l) / k_m) * ((l / ((fma(cos((k_m + k_m)), -0.5, 0.5) * t) * k_m)) * cos(k_m));
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(Float64(l + l) / k_m) * Float64(Float64(l / Float64(Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t) * k_m)) * cos(k_m)));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l + l), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(N[(l / N[(N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\ell + \ell}{k\_m} \cdot \left(\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m} \cdot \cos k\_m\right)\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)\right)} \]
      2. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)}\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \color{blue}{\left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)} \]
      4. count-2N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \left(\color{blue}{\frac{\cos k}{k}} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \]
      5. lift-+.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \left(\color{blue}{\frac{\cos k}{k}} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}}\right) \]
      7. lift-/.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \]
      8. lift-/.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}}\right) \]
      9. frac-timesN/A

        \[\leadsto \left(\ell + \ell\right) \cdot \frac{\cos k \cdot \ell}{\color{blue}{k \cdot \left(\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k\right)}} \]
      10. lift-*.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \frac{\cos k \cdot \ell}{\color{blue}{k} \cdot \left(\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k\right)} \]
      11. *-commutativeN/A

        \[\leadsto \left(\ell + \ell\right) \cdot \frac{\cos k \cdot \ell}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}} \]
      12. lift-*.f64N/A

        \[\leadsto \left(\ell + \ell\right) \cdot \frac{\cos k \cdot \ell}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}} \]
      13. associate-/l*N/A

        \[\leadsto \frac{\left(\ell + \ell\right) \cdot \left(\cos k \cdot \ell\right)}{\color{blue}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k\right) \cdot k}} \]
    10. Applied rewrites84.1%

      \[\leadsto \frac{\ell + \ell}{k} \cdot \color{blue}{\left(\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k} \cdot \cos k\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 91.2% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos k\_m \cdot \ell\right) \cdot \frac{\frac{\ell + \ell}{\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m}}{k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (*
    (* (cos k_m) l)
    (/ (/ (+ l l) (* (* (fma (cos (+ k_m k_m)) -0.5 0.5) t) k_m)) k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = (cos(k_m) * l) * (((l + l) / ((fma(cos((k_m + k_m)), -0.5, 0.5) * t) * k_m)) / k_m);
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(cos(k_m) * l) * Float64(Float64(Float64(l + l) / Float64(Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t) * k_m)) / k_m));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(l + l), $MachinePrecision] / N[(N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\left(\cos k\_m \cdot \ell\right) \cdot \frac{\frac{\ell + \ell}{\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m}}{k\_m}\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Applied rewrites83.3%

      \[\leadsto \left(\cos k \cdot \ell\right) \cdot \color{blue}{\frac{\frac{\ell + \ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}{k}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 87.1% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\ell + \ell\right) \cdot \frac{\cos k\_m}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right) \cdot \ell\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (*
    (*
     (+ l l)
     (/ (cos k_m) (* (* (* (fma (cos (+ k_m k_m)) -0.5 0.5) t) k_m) k_m)))
    l)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = ((l + l) * (cos(k_m) / (((fma(cos((k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m))) * l;
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(Float64(l + l) * Float64(cos(k_m) / Float64(Float64(Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m))) * l);
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l + l), $MachinePrecision] * N[(N[Cos[k$95$m], $MachinePrecision] / N[(N[(N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\left(\left(\ell + \ell\right) \cdot \frac{\cos k\_m}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right) \cdot \ell\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right)} \]
      2. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      5. *-commutativeN/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \left(\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k} \cdot \color{blue}{\ell}\right) \]
      6. associate-*r*N/A

        \[\leadsto \left(\left(2 \cdot \ell\right) \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right) \cdot \color{blue}{\ell} \]
      7. lower-*.f64N/A

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

      \[\leadsto \left(\left(\ell + \ell\right) \cdot \frac{\cos k}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k\right) \cdot k}\right) \cdot \color{blue}{\ell} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 87.1% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos k\_m \cdot \ell\right) \cdot \frac{\ell + \ell}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (*
    (* (cos k_m) l)
    (/ (+ l l) (* (* (* (fma (cos (+ k_m k_m)) -0.5 0.5) t) k_m) k_m)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = (cos(k_m) * l) * ((l + l) / (((fma(cos((k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m));
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(cos(k_m) * l) * Float64(Float64(l + l) / Float64(Float64(Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m)));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * N[(N[(l + l), $MachinePrecision] / N[(N[(N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\left(\cos k\_m \cdot \ell\right) \cdot \frac{\ell + \ell}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right)} \]
      2. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      5. lift-/.f64N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      6. associate-*r/N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}} \]
      7. *-commutativeN/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k} \]
      8. lift-*.f64N/A

        \[\leadsto \left(2 \cdot \ell\right) \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k} \]
      9. associate-*r/N/A

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

      \[\leadsto \left(\cos k \cdot \ell\right) \cdot \color{blue}{\frac{\ell + \ell}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k\right) \cdot k}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 87.1% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\cos k\_m \cdot \frac{\ell}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right) \cdot \left(\ell + \ell\right)\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 8.5e-6)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (*
    (* (cos k_m) (/ l (* (* (* (fma (cos (+ k_m k_m)) -0.5 0.5) t) k_m) k_m)))
    (+ l l))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 8.5e-6) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = (cos(k_m) * (l / (((fma(cos((k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m))) * (l + l);
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 8.5e-6)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(Float64(cos(k_m) * Float64(l / Float64(Float64(Float64(fma(cos(Float64(k_m + k_m)), -0.5, 0.5) * t) * k_m) * k_m))) * Float64(l + l));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-6], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k$95$m], $MachinePrecision] * N[(l / N[(N[(N[(N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\left(\cos k\_m \cdot \frac{\ell}{\left(\left(\mathsf{fma}\left(\cos \left(k\_m + k\_m\right), -0.5, 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right) \cdot \left(\ell + \ell\right)\\


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

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.4999999999999999e-6 < k

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)\right)} \]
      2. count-2-revN/A

        \[\leadsto \ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) + \color{blue}{\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) + \color{blue}{\ell} \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) + \ell \cdot \color{blue}{\left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right)} \]
      5. distribute-rgt-outN/A

        \[\leadsto \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \cdot \color{blue}{\left(\ell + \ell\right)} \]
      6. lift-+.f64N/A

        \[\leadsto \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot t\right) \cdot k}\right) \cdot \left(\ell + \color{blue}{\ell}\right) \]
      7. lower-*.f6483.3

        \[\leadsto \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}\right) \cdot \color{blue}{\left(\ell + \ell\right)} \]
    10. Applied rewrites79.0%

      \[\leadsto \color{blue}{\left(\cos k \cdot \frac{\ell}{\left(\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k\right) \cdot k}\right) \cdot \left(\ell + \ell\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 74.1% accurate, 1.7× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;\ell \leq 8.1 \cdot 10^{+145}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k\_m}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right)\right)\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= l 8.1e+145)
   (* 2.0 (* l (* (/ (cos k_m) k_m) (/ l (* (* (pow k_m 2.0) t) k_m)))))
   (* 2.0 (* l (* l (/ (cos k_m) (* (* (* (- 0.5 0.5) t) k_m) k_m)))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (l <= 8.1e+145) {
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / ((pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = 2.0 * (l * (l * (cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
	}
	return tmp;
}
k_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(t, l, k_m)
use fmin_fmax_functions
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    real(8) :: tmp
    if (l <= 8.1d+145) then
        tmp = 2.0d0 * (l * ((cos(k_m) / k_m) * (l / (((k_m ** 2.0d0) * t) * k_m))))
    else
        tmp = 2.0d0 * (l * (l * (cos(k_m) / ((((0.5d0 - 0.5d0) * t) * k_m) * k_m))))
    end if
    code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	double tmp;
	if (l <= 8.1e+145) {
		tmp = 2.0 * (l * ((Math.cos(k_m) / k_m) * (l / ((Math.pow(k_m, 2.0) * t) * k_m))));
	} else {
		tmp = 2.0 * (l * (l * (Math.cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if l <= 8.1e+145:
		tmp = 2.0 * (l * ((math.cos(k_m) / k_m) * (l / ((math.pow(k_m, 2.0) * t) * k_m))))
	else:
		tmp = 2.0 * (l * (l * (math.cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))))
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (l <= 8.1e+145)
		tmp = Float64(2.0 * Float64(l * Float64(Float64(cos(k_m) / k_m) * Float64(l / Float64(Float64((k_m ^ 2.0) * t) * k_m)))));
	else
		tmp = Float64(2.0 * Float64(l * Float64(l * Float64(cos(k_m) / Float64(Float64(Float64(Float64(0.5 - 0.5) * t) * k_m) * k_m)))));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (l <= 8.1e+145)
		tmp = 2.0 * (l * ((cos(k_m) / k_m) * (l / (((k_m ^ 2.0) * t) * k_m))));
	else
		tmp = 2.0 * (l * (l * (cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[l, 8.1e+145], N[(2.0 * N[(l * N[(N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(l * N[(l * N[(N[Cos[k$95$m], $MachinePrecision] / N[(N[(N[(N[(0.5 - 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.1 \cdot 10^{+145}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \left(\frac{\cos k\_m}{k\_m} \cdot \frac{\ell}{\left({k\_m}^{2} \cdot t\right) \cdot k\_m}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 8.1000000000000001e145

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \color{blue}{\frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right)\right) \]
      3. associate-*r/N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\ell \cdot \cos k}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}}\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)} \cdot k}\right) \]
      5. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot \color{blue}{k}}\right) \]
      6. *-commutativeN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \frac{\cos k \cdot \ell}{k \cdot \color{blue}{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right)}}\right) \]
      7. times-fracN/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\color{blue}{\ell}}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}\right)\right) \]
      10. lower-/.f6483.3

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\color{blue}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}}\right)\right) \]
    8. Applied rewrites83.3%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \color{blue}{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(k + k\right), -0.5, 0.5\right) \cdot t\right) \cdot k}}\right)\right) \]
    9. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    10. Step-by-step derivation
      1. lower-pow.f6473.6

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\frac{\cos k}{k} \cdot \frac{\ell}{\left({k}^{2} \cdot t\right) \cdot k}\right)\right) \]
    11. Applied rewrites73.6%

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

    if 8.1000000000000001e145 < l

    1. Initial program 36.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. Taylor expanded in t around 0

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

        \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lower-/.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
      5. lower-cos.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
      7. lower-pow.f64N/A

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

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
      9. lower-pow.f64N/A

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

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      2. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
      4. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
      7. lower-*.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
      10. lift-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
      12. lift-pow.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
      15. lower-*.f64N/A

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

      \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
    7. Taylor expanded in k around 0

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    8. Step-by-step derivation
      1. Applied rewrites41.4%

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 9: 71.0% accurate, 2.1× speedup?

    \[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;\ell \leq 8.1 \cdot 10^{+145}:\\ \;\;\;\;\frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k\_m}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right)\right)\\ \end{array} \end{array} \]
    k_m = (fabs.f64 k)
    (FPCore (t l k_m)
     :precision binary64
     (if (<= l 8.1e+145)
       (* (/ (* (+ l l) (pow k_m -4.0)) t) l)
       (* 2.0 (* l (* l (/ (cos k_m) (* (* (* (- 0.5 0.5) t) k_m) k_m)))))))
    k_m = fabs(k);
    double code(double t, double l, double k_m) {
    	double tmp;
    	if (l <= 8.1e+145) {
    		tmp = (((l + l) * pow(k_m, -4.0)) / t) * l;
    	} else {
    		tmp = 2.0 * (l * (l * (cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
    	}
    	return tmp;
    }
    
    k_m =     private
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(t, l, k_m)
    use fmin_fmax_functions
        real(8), intent (in) :: t
        real(8), intent (in) :: l
        real(8), intent (in) :: k_m
        real(8) :: tmp
        if (l <= 8.1d+145) then
            tmp = (((l + l) * (k_m ** (-4.0d0))) / t) * l
        else
            tmp = 2.0d0 * (l * (l * (cos(k_m) / ((((0.5d0 - 0.5d0) * t) * k_m) * k_m))))
        end if
        code = tmp
    end function
    
    k_m = Math.abs(k);
    public static double code(double t, double l, double k_m) {
    	double tmp;
    	if (l <= 8.1e+145) {
    		tmp = (((l + l) * Math.pow(k_m, -4.0)) / t) * l;
    	} else {
    		tmp = 2.0 * (l * (l * (Math.cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
    	}
    	return tmp;
    }
    
    k_m = math.fabs(k)
    def code(t, l, k_m):
    	tmp = 0
    	if l <= 8.1e+145:
    		tmp = (((l + l) * math.pow(k_m, -4.0)) / t) * l
    	else:
    		tmp = 2.0 * (l * (l * (math.cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))))
    	return tmp
    
    k_m = abs(k)
    function code(t, l, k_m)
    	tmp = 0.0
    	if (l <= 8.1e+145)
    		tmp = Float64(Float64(Float64(Float64(l + l) * (k_m ^ -4.0)) / t) * l);
    	else
    		tmp = Float64(2.0 * Float64(l * Float64(l * Float64(cos(k_m) / Float64(Float64(Float64(Float64(0.5 - 0.5) * t) * k_m) * k_m)))));
    	end
    	return tmp
    end
    
    k_m = abs(k);
    function tmp_2 = code(t, l, k_m)
    	tmp = 0.0;
    	if (l <= 8.1e+145)
    		tmp = (((l + l) * (k_m ^ -4.0)) / t) * l;
    	else
    		tmp = 2.0 * (l * (l * (cos(k_m) / ((((0.5 - 0.5) * t) * k_m) * k_m))));
    	end
    	tmp_2 = tmp;
    end
    
    k_m = N[Abs[k], $MachinePrecision]
    code[t_, l_, k$95$m_] := If[LessEqual[l, 8.1e+145], N[(N[(N[(N[(l + l), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision], N[(2.0 * N[(l * N[(l * N[(N[Cos[k$95$m], $MachinePrecision] / N[(N[(N[(N[(0.5 - 0.5), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    k_m = \left|k\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\ell \leq 8.1 \cdot 10^{+145}:\\
    \;\;\;\;\frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell\\
    
    \mathbf{else}:\\
    \;\;\;\;2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k\_m}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\_m\right) \cdot k\_m}\right)\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if l < 8.1000000000000001e145

      1. Initial program 36.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. Taylor expanded in k around 0

        \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. lower-/.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4} \cdot t}} \]
        3. lower-pow.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4}} \cdot t} \]
        4. lower-*.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot \color{blue}{t}} \]
        5. lower-pow.f6463.5

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} \]
      4. Applied rewrites63.5%

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

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. *-commutativeN/A

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

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot \color{blue}{2} \]
        4. lift-/.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        5. lift-pow.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        6. pow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{{k}^{4} \cdot t} \cdot 2 \]
        7. associate-/l*N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        8. lower-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        9. lower-/.f6469.5

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
      6. Applied rewrites69.5%

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

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot \color{blue}{2} \]
        2. lift-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        3. associate-*l*N/A

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

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        5. lower-*.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        6. lift-/.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \ell \]
        7. associate-*l/N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        8. lower-/.f64N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        9. *-commutativeN/A

          \[\leadsto \frac{2 \cdot \ell}{{k}^{4} \cdot t} \cdot \ell \]
        10. count-2-revN/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        11. lower-+.f6469.5

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
      8. Applied rewrites69.5%

        \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \color{blue}{\ell} \]
      9. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        3. associate-/r*N/A

          \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
        4. lower-/.f64N/A

          \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
        5. mult-flipN/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        7. lift-pow.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        8. pow-flipN/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
        9. lower-pow.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
        10. metadata-eval70.0

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{-4}}{t} \cdot \ell \]
      10. Applied rewrites70.0%

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

      if 8.1000000000000001e145 < l

      1. Initial program 36.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. Taylor expanded in t around 0

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

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
        2. lower-/.f64N/A

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

          \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2}} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
        4. lower-pow.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{\color{blue}{k}}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
        5. lower-cos.f64N/A

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

          \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \]
        7. lower-pow.f64N/A

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

          \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot \color{blue}{{\sin k}^{2}}\right)} \]
        9. lower-pow.f64N/A

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

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

        \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      5. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2} \cdot \cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
        2. lift-*.f64N/A

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

          \[\leadsto 2 \cdot \left({\ell}^{2} \cdot \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right) \]
        4. lift-pow.f64N/A

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

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

          \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}\right)}\right) \]
        7. lower-*.f64N/A

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

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

          \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}}\right)\right) \]
        10. lift-*.f64N/A

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

          \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(t \cdot {\sin k}^{2}\right) \cdot \color{blue}{{k}^{2}}}\right)\right) \]
        12. lift-pow.f64N/A

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

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

          \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(t \cdot {\sin k}^{2}\right) \cdot k\right) \cdot \color{blue}{k}}\right)\right) \]
        15. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k\right) \cdot k}\right)}\right) \]
      7. Taylor expanded in k around 0

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
      8. Step-by-step derivation
        1. Applied rewrites41.4%

          \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
      9. Recombined 2 regimes into one program.
      10. Add Preprocessing

      Alternative 10: 70.3% accurate, 3.9× speedup?

      \[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 4.55 \cdot 10^{+21}:\\ \;\;\;\;\frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{{k\_m}^{2} \cdot t} \cdot \left(\ell \cdot \ell\right)\\ \end{array} \end{array} \]
      k_m = (fabs.f64 k)
      (FPCore (t l k_m)
       :precision binary64
       (if (<= k_m 4.55e+21)
         (* (/ (* (+ l l) (pow k_m -4.0)) t) l)
         (* (/ -0.3333333333333333 (* (pow k_m 2.0) t)) (* l l))))
      k_m = fabs(k);
      double code(double t, double l, double k_m) {
      	double tmp;
      	if (k_m <= 4.55e+21) {
      		tmp = (((l + l) * pow(k_m, -4.0)) / t) * l;
      	} else {
      		tmp = (-0.3333333333333333 / (pow(k_m, 2.0) * t)) * (l * l);
      	}
      	return tmp;
      }
      
      k_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(t, l, k_m)
      use fmin_fmax_functions
          real(8), intent (in) :: t
          real(8), intent (in) :: l
          real(8), intent (in) :: k_m
          real(8) :: tmp
          if (k_m <= 4.55d+21) then
              tmp = (((l + l) * (k_m ** (-4.0d0))) / t) * l
          else
              tmp = ((-0.3333333333333333d0) / ((k_m ** 2.0d0) * t)) * (l * l)
          end if
          code = tmp
      end function
      
      k_m = Math.abs(k);
      public static double code(double t, double l, double k_m) {
      	double tmp;
      	if (k_m <= 4.55e+21) {
      		tmp = (((l + l) * Math.pow(k_m, -4.0)) / t) * l;
      	} else {
      		tmp = (-0.3333333333333333 / (Math.pow(k_m, 2.0) * t)) * (l * l);
      	}
      	return tmp;
      }
      
      k_m = math.fabs(k)
      def code(t, l, k_m):
      	tmp = 0
      	if k_m <= 4.55e+21:
      		tmp = (((l + l) * math.pow(k_m, -4.0)) / t) * l
      	else:
      		tmp = (-0.3333333333333333 / (math.pow(k_m, 2.0) * t)) * (l * l)
      	return tmp
      
      k_m = abs(k)
      function code(t, l, k_m)
      	tmp = 0.0
      	if (k_m <= 4.55e+21)
      		tmp = Float64(Float64(Float64(Float64(l + l) * (k_m ^ -4.0)) / t) * l);
      	else
      		tmp = Float64(Float64(-0.3333333333333333 / Float64((k_m ^ 2.0) * t)) * Float64(l * l));
      	end
      	return tmp
      end
      
      k_m = abs(k);
      function tmp_2 = code(t, l, k_m)
      	tmp = 0.0;
      	if (k_m <= 4.55e+21)
      		tmp = (((l + l) * (k_m ^ -4.0)) / t) * l;
      	else
      		tmp = (-0.3333333333333333 / ((k_m ^ 2.0) * t)) * (l * l);
      	end
      	tmp_2 = tmp;
      end
      
      k_m = N[Abs[k], $MachinePrecision]
      code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 4.55e+21], N[(N[(N[(N[(l + l), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision], N[(N[(-0.3333333333333333 / N[(N[Power[k$95$m, 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      k_m = \left|k\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;k\_m \leq 4.55 \cdot 10^{+21}:\\
      \;\;\;\;\frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{-0.3333333333333333}{{k\_m}^{2} \cdot t} \cdot \left(\ell \cdot \ell\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if k < 4.55e21

        1. Initial program 36.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. Taylor expanded in k around 0

          \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
          2. lower-/.f64N/A

            \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4} \cdot t}} \]
          3. lower-pow.f64N/A

            \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4}} \cdot t} \]
          4. lower-*.f64N/A

            \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot \color{blue}{t}} \]
          5. lower-pow.f6463.5

            \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} \]
        4. Applied rewrites63.5%

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

            \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
          2. *-commutativeN/A

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

            \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot \color{blue}{2} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
          5. lift-pow.f64N/A

            \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
          6. pow2N/A

            \[\leadsto \frac{\ell \cdot \ell}{{k}^{4} \cdot t} \cdot 2 \]
          7. associate-/l*N/A

            \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
          8. lower-*.f64N/A

            \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
          9. lower-/.f6469.5

            \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        6. Applied rewrites69.5%

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

            \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot \color{blue}{2} \]
          2. lift-*.f64N/A

            \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
          3. associate-*l*N/A

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

            \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
          5. lower-*.f64N/A

            \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
          6. lift-/.f64N/A

            \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \ell \]
          7. associate-*l/N/A

            \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
          8. lower-/.f64N/A

            \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
          9. *-commutativeN/A

            \[\leadsto \frac{2 \cdot \ell}{{k}^{4} \cdot t} \cdot \ell \]
          10. count-2-revN/A

            \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
          11. lower-+.f6469.5

            \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        8. Applied rewrites69.5%

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \color{blue}{\ell} \]
        9. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
          3. associate-/r*N/A

            \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
          4. lower-/.f64N/A

            \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
          5. mult-flipN/A

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
          6. lower-*.f64N/A

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
          7. lift-pow.f64N/A

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
          8. pow-flipN/A

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
          9. lower-pow.f64N/A

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
          10. metadata-eval70.0

            \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{-4}}{t} \cdot \ell \]
        10. Applied rewrites70.0%

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

        if 4.55e21 < k

        1. Initial program 36.4%

          \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\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. frac-2negN/A

            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(2\right)}{\mathsf{neg}\left(\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)\right)}} \]
          3. frac-2negN/A

            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(2\right)\right)\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\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)\right)\right)\right)}} \]
          4. remove-double-negN/A

            \[\leadsto \frac{\color{blue}{2}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\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)\right)\right)\right)} \]
          5. remove-double-negN/A

            \[\leadsto \frac{2}{\color{blue}{\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)}} \]
          6. lift-*.f64N/A

            \[\leadsto \frac{2}{\color{blue}{\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)}} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{2}{\color{blue}{\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)} \]
          8. associate-*l*N/A

            \[\leadsto \frac{2}{\color{blue}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)\right)}} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{2}{\color{blue}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right)} \cdot \left(\tan k \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)\right)} \]
          10. lift-/.f64N/A

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

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

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

          \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \frac{{k}^{2}}{t} + 2 \cdot \frac{1}{t}}{{k}^{4}}} \cdot \left(\ell \cdot \ell\right) \]
        5. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\frac{-1}{3} \cdot \frac{{k}^{2}}{t} + 2 \cdot \frac{1}{t}}{\color{blue}{{k}^{4}}} \cdot \left(\ell \cdot \ell\right) \]
          2. lower-fma.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{\color{blue}{k}}^{4}} \cdot \left(\ell \cdot \ell\right) \]
          3. lower-/.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{4}} \cdot \left(\ell \cdot \ell\right) \]
          4. lower-pow.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{4}} \cdot \left(\ell \cdot \ell\right) \]
          5. lower-*.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{4}} \cdot \left(\ell \cdot \ell\right) \]
          6. lower-/.f64N/A

            \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{4}} \cdot \left(\ell \cdot \ell\right) \]
          7. lower-pow.f6446.3

            \[\leadsto \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{\color{blue}{4}}} \cdot \left(\ell \cdot \ell\right) \]
        6. Applied rewrites46.3%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{{k}^{2}}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{4}}} \cdot \left(\ell \cdot \ell\right) \]
        7. Taylor expanded in k around inf

          \[\leadsto \frac{\frac{-1}{3}}{\color{blue}{{k}^{2} \cdot t}} \cdot \left(\ell \cdot \ell\right) \]
        8. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\frac{-1}{3}}{{k}^{2} \cdot \color{blue}{t}} \cdot \left(\ell \cdot \ell\right) \]
          2. lower-*.f64N/A

            \[\leadsto \frac{\frac{-1}{3}}{{k}^{2} \cdot t} \cdot \left(\ell \cdot \ell\right) \]
          3. lower-pow.f6430.1

            \[\leadsto \frac{-0.3333333333333333}{{k}^{2} \cdot t} \cdot \left(\ell \cdot \ell\right) \]
        9. Applied rewrites30.1%

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

      Alternative 11: 70.0% accurate, 4.4× speedup?

      \[\begin{array}{l} k_m = \left|k\right| \\ \frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell \end{array} \]
      k_m = (fabs.f64 k)
      (FPCore (t l k_m) :precision binary64 (* (/ (* (+ l l) (pow k_m -4.0)) t) l))
      k_m = fabs(k);
      double code(double t, double l, double k_m) {
      	return (((l + l) * pow(k_m, -4.0)) / t) * l;
      }
      
      k_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(t, l, k_m)
      use fmin_fmax_functions
          real(8), intent (in) :: t
          real(8), intent (in) :: l
          real(8), intent (in) :: k_m
          code = (((l + l) * (k_m ** (-4.0d0))) / t) * l
      end function
      
      k_m = Math.abs(k);
      public static double code(double t, double l, double k_m) {
      	return (((l + l) * Math.pow(k_m, -4.0)) / t) * l;
      }
      
      k_m = math.fabs(k)
      def code(t, l, k_m):
      	return (((l + l) * math.pow(k_m, -4.0)) / t) * l
      
      k_m = abs(k)
      function code(t, l, k_m)
      	return Float64(Float64(Float64(Float64(l + l) * (k_m ^ -4.0)) / t) * l)
      end
      
      k_m = abs(k);
      function tmp = code(t, l, k_m)
      	tmp = (((l + l) * (k_m ^ -4.0)) / t) * l;
      end
      
      k_m = N[Abs[k], $MachinePrecision]
      code[t_, l_, k$95$m_] := N[(N[(N[(N[(l + l), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision]
      
      \begin{array}{l}
      k_m = \left|k\right|
      
      \\
      \frac{\left(\ell + \ell\right) \cdot {k\_m}^{-4}}{t} \cdot \ell
      \end{array}
      
      Derivation
      1. Initial program 36.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. Taylor expanded in k around 0

        \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. lower-/.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4} \cdot t}} \]
        3. lower-pow.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4}} \cdot t} \]
        4. lower-*.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot \color{blue}{t}} \]
        5. lower-pow.f6463.5

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} \]
      4. Applied rewrites63.5%

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

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. *-commutativeN/A

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

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot \color{blue}{2} \]
        4. lift-/.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        5. lift-pow.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        6. pow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{{k}^{4} \cdot t} \cdot 2 \]
        7. associate-/l*N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        8. lower-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        9. lower-/.f6469.5

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
      6. Applied rewrites69.5%

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

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot \color{blue}{2} \]
        2. lift-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        3. associate-*l*N/A

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

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        5. lower-*.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        6. lift-/.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \ell \]
        7. associate-*l/N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        8. lower-/.f64N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        9. *-commutativeN/A

          \[\leadsto \frac{2 \cdot \ell}{{k}^{4} \cdot t} \cdot \ell \]
        10. count-2-revN/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        11. lower-+.f6469.5

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
      8. Applied rewrites69.5%

        \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \color{blue}{\ell} \]
      9. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        3. associate-/r*N/A

          \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
        4. lower-/.f64N/A

          \[\leadsto \frac{\frac{\ell + \ell}{{k}^{4}}}{t} \cdot \ell \]
        5. mult-flipN/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        7. lift-pow.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}}{t} \cdot \ell \]
        8. pow-flipN/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
        9. lower-pow.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t} \cdot \ell \]
        10. metadata-eval70.0

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot {k}^{-4}}{t} \cdot \ell \]
      10. Applied rewrites70.0%

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

      Alternative 12: 68.5% accurate, 4.4× speedup?

      \[\begin{array}{l} k_m = \left|k\right| \\ \left(\left(\ell + \ell\right) \cdot {k\_m}^{-4}\right) \cdot \frac{\ell}{t} \end{array} \]
      k_m = (fabs.f64 k)
      (FPCore (t l k_m) :precision binary64 (* (* (+ l l) (pow k_m -4.0)) (/ l t)))
      k_m = fabs(k);
      double code(double t, double l, double k_m) {
      	return ((l + l) * pow(k_m, -4.0)) * (l / t);
      }
      
      k_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(t, l, k_m)
      use fmin_fmax_functions
          real(8), intent (in) :: t
          real(8), intent (in) :: l
          real(8), intent (in) :: k_m
          code = ((l + l) * (k_m ** (-4.0d0))) * (l / t)
      end function
      
      k_m = Math.abs(k);
      public static double code(double t, double l, double k_m) {
      	return ((l + l) * Math.pow(k_m, -4.0)) * (l / t);
      }
      
      k_m = math.fabs(k)
      def code(t, l, k_m):
      	return ((l + l) * math.pow(k_m, -4.0)) * (l / t)
      
      k_m = abs(k)
      function code(t, l, k_m)
      	return Float64(Float64(Float64(l + l) * (k_m ^ -4.0)) * Float64(l / t))
      end
      
      k_m = abs(k);
      function tmp = code(t, l, k_m)
      	tmp = ((l + l) * (k_m ^ -4.0)) * (l / t);
      end
      
      k_m = N[Abs[k], $MachinePrecision]
      code[t_, l_, k$95$m_] := N[(N[(N[(l + l), $MachinePrecision] * N[Power[k$95$m, -4.0], $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      k_m = \left|k\right|
      
      \\
      \left(\left(\ell + \ell\right) \cdot {k\_m}^{-4}\right) \cdot \frac{\ell}{t}
      \end{array}
      
      Derivation
      1. Initial program 36.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. Taylor expanded in k around 0

        \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. lower-/.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4} \cdot t}} \]
        3. lower-pow.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{4}} \cdot t} \]
        4. lower-*.f64N/A

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot \color{blue}{t}} \]
        5. lower-pow.f6463.5

          \[\leadsto 2 \cdot \frac{{\ell}^{2}}{{k}^{4} \cdot t} \]
      4. Applied rewrites63.5%

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

          \[\leadsto 2 \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{4} \cdot t}} \]
        2. *-commutativeN/A

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

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot \color{blue}{2} \]
        4. lift-/.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        5. lift-pow.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{{k}^{4} \cdot t} \cdot 2 \]
        6. pow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{{k}^{4} \cdot t} \cdot 2 \]
        7. associate-/l*N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        8. lower-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        9. lower-/.f6469.5

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
      6. Applied rewrites69.5%

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

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot \color{blue}{2} \]
        2. lift-*.f64N/A

          \[\leadsto \left(\ell \cdot \frac{\ell}{{k}^{4} \cdot t}\right) \cdot 2 \]
        3. associate-*l*N/A

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

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        5. lower-*.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \color{blue}{\ell} \]
        6. lift-/.f64N/A

          \[\leadsto \left(\frac{\ell}{{k}^{4} \cdot t} \cdot 2\right) \cdot \ell \]
        7. associate-*l/N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        8. lower-/.f64N/A

          \[\leadsto \frac{\ell \cdot 2}{{k}^{4} \cdot t} \cdot \ell \]
        9. *-commutativeN/A

          \[\leadsto \frac{2 \cdot \ell}{{k}^{4} \cdot t} \cdot \ell \]
        10. count-2-revN/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        11. lower-+.f6469.5

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
      8. Applied rewrites69.5%

        \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \color{blue}{\ell} \]
      9. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \color{blue}{\ell} \]
        2. lift-/.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
        3. associate-*l/N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \ell}{\color{blue}{{k}^{4} \cdot t}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{\left(\ell + \ell\right) \cdot \ell}{{k}^{4} \cdot \color{blue}{t}} \]
        5. times-fracN/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4}} \cdot \color{blue}{\frac{\ell}{t}} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\ell + \ell}{{k}^{4}} \cdot \color{blue}{\frac{\ell}{t}} \]
        7. mult-flipN/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}\right) \cdot \frac{\color{blue}{\ell}}{t} \]
        8. lower-*.f64N/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}\right) \cdot \frac{\color{blue}{\ell}}{t} \]
        9. lift-pow.f64N/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot \frac{1}{{k}^{4}}\right) \cdot \frac{\ell}{t} \]
        10. pow-flipN/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}\right) \cdot \frac{\ell}{t} \]
        11. lower-pow.f64N/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}\right) \cdot \frac{\ell}{t} \]
        12. metadata-evalN/A

          \[\leadsto \left(\left(\ell + \ell\right) \cdot {k}^{-4}\right) \cdot \frac{\ell}{t} \]
        13. lower-/.f6468.5

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

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

      Reproduce

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