Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.0% → 86.4%
Time: 7.4s
Alternatives: 11
Speedup: 5.7×

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 11 alternatives:

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

Initial Program: 36.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
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: 86.4% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\cos k\_m \cdot \ell\right) \cdot \ell}{\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 0.5\right) \cdot t\right) \cdot k\_m} \cdot \frac{2}{k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 1.7e-6)
   (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m)))
   (*
    (/ (* (* (cos k_m) l) l) (* (* (- 0.5 (* (cos (+ k_m k_m)) 0.5)) t) k_m))
    (/ 2.0 k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((cos(k_m) * l) * l) / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (2.0 / 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 (k_m <= 1.7d-6) then
        tmp = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
    else
        tmp = (((cos(k_m) * l) * l) / (((0.5d0 - (cos((k_m + k_m)) * 0.5d0)) * t) * k_m)) * (2.0d0 / 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 (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((Math.cos(k_m) * l) * l) / (((0.5 - (Math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (2.0 / k_m);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 1.7e-6:
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
	else:
		tmp = (((math.cos(k_m) * l) * l) / (((0.5 - (math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (2.0 / k_m)
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 1.7e-6)
		tmp = Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)));
	else
		tmp = Float64(Float64(Float64(Float64(cos(k_m) * l) * l) / Float64(Float64(Float64(0.5 - Float64(cos(Float64(k_m + k_m)) * 0.5)) * t) * k_m)) * Float64(2.0 / k_m));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (k_m <= 1.7e-6)
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	else
		tmp = (((cos(k_m) * l) * l) / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (2.0 / k_m);
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.7e-6], N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] / N[(N[(N[(0.5 - N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

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


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

    1. Initial program 42.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in k around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
      8. pow-prod-upN/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
      10. unpow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
      12. unpow2N/A

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      13. lower-*.f6474.0

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      3. pow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
      5. unpow-prod-downN/A

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
      12. lift-*.f6476.4

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
    8. Applied rewrites76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
      17. times-fracN/A

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

        \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
    10. Applied rewrites93.4%

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

    if 1.70000000000000003e-6 < k

    1. Initial program 29.8%

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

        \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      5. sqr-sin-a-revN/A

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left({\sin k}^{2} \cdot t\right) \cdot \left(k \cdot k\right)} \]
      8. lift-sin.f6471.5

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

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

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

Alternative 2: 86.4% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\ell \cdot \ell\right) \cdot 2}{\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 0.5\right) \cdot t\right) \cdot k\_m} \cdot \frac{\cos k\_m}{k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 1.7e-6)
   (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m)))
   (*
    (/ (* (* l l) 2.0) (* (* (- 0.5 (* (cos (+ k_m k_m)) 0.5)) t) k_m))
    (/ (cos k_m) k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((l * l) * 2.0) / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (cos(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 (k_m <= 1.7d-6) then
        tmp = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
    else
        tmp = (((l * l) * 2.0d0) / (((0.5d0 - (cos((k_m + k_m)) * 0.5d0)) * t) * k_m)) * (cos(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 (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((l * l) * 2.0) / (((0.5 - (Math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (Math.cos(k_m) / k_m);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 1.7e-6:
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
	else:
		tmp = (((l * l) * 2.0) / (((0.5 - (math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (math.cos(k_m) / k_m)
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 1.7e-6)
		tmp = Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)));
	else
		tmp = Float64(Float64(Float64(Float64(l * l) * 2.0) / Float64(Float64(Float64(0.5 - Float64(cos(Float64(k_m + k_m)) * 0.5)) * t) * k_m)) * Float64(cos(k_m) / k_m));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (k_m <= 1.7e-6)
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	else
		tmp = (((l * l) * 2.0) / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (cos(k_m) / k_m);
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.7e-6], N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(N[(0.5 - N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k$95$m], $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

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


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

    1. Initial program 42.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in k around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
      8. pow-prod-upN/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
      10. unpow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
      12. unpow2N/A

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      13. lower-*.f6474.0

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      3. pow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
      5. unpow-prod-downN/A

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
      12. lift-*.f6476.4

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
    8. Applied rewrites76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
      17. times-fracN/A

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

        \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
    10. Applied rewrites93.4%

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

    if 1.70000000000000003e-6 < k

    1. Initial program 29.8%

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

        \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      5. sqr-sin-a-revN/A

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left({\sin k}^{2} \cdot t\right) \cdot \left(k \cdot k\right)} \]
      8. lift-sin.f6471.5

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

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

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

Alternative 3: 86.3% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 0.5\right) \cdot t\right) \cdot k\_m} \cdot \frac{\left(\cos k\_m \cdot \ell\right) \cdot \ell}{k\_m}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 1.7e-6)
   (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m)))
   (*
    (/ 2.0 (* (* (- 0.5 (* (cos (+ k_m k_m)) 0.5)) t) k_m))
    (/ (* (* (cos k_m) l) l) k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (2.0 / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (((cos(k_m) * l) * l) / 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 (k_m <= 1.7d-6) then
        tmp = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
    else
        tmp = (2.0d0 / (((0.5d0 - (cos((k_m + k_m)) * 0.5d0)) * t) * k_m)) * (((cos(k_m) * l) * l) / 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 (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (2.0 / (((0.5 - (Math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (((Math.cos(k_m) * l) * l) / k_m);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 1.7e-6:
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
	else:
		tmp = (2.0 / (((0.5 - (math.cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (((math.cos(k_m) * l) * l) / k_m)
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 1.7e-6)
		tmp = Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)));
	else
		tmp = Float64(Float64(2.0 / Float64(Float64(Float64(0.5 - Float64(cos(Float64(k_m + k_m)) * 0.5)) * t) * k_m)) * Float64(Float64(Float64(cos(k_m) * l) * l) / k_m));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (k_m <= 1.7e-6)
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	else
		tmp = (2.0 / (((0.5 - (cos((k_m + k_m)) * 0.5)) * t) * k_m)) * (((cos(k_m) * l) * l) / k_m);
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.7e-6], N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(N[(N[(0.5 - N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

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


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

    1. Initial program 42.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in k around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
      8. pow-prod-upN/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
      10. unpow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
      12. unpow2N/A

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      13. lower-*.f6474.0

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      3. pow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
      5. unpow-prod-downN/A

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
      12. lift-*.f6476.4

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
    8. Applied rewrites76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
      17. times-fracN/A

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

        \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
    10. Applied rewrites93.4%

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

    if 1.70000000000000003e-6 < k

    1. Initial program 29.8%

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

        \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      5. sqr-sin-a-revN/A

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

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

        \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left({\sin k}^{2} \cdot t\right) \cdot \left(k \cdot k\right)} \]
      8. lift-sin.f6471.5

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

      \[\leadsto \frac{2 \cdot \left(\cos k \cdot \left(\ell \cdot \ell\right)\right)}{\left({\sin k}^{2} \cdot t\right) \cdot \left(k \cdot k\right)} \]
    7. Applied rewrites79.5%

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

Alternative 4: 84.7% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(\cos k\_m \cdot \left(\ell \cdot \ell\right)\right)}{\left(\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 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 1.7e-6)
   (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m)))
   (/
    (* 2.0 (* (cos k_m) (* l l)))
    (* (* (* (- 0.5 (* (cos (+ k_m k_m)) 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 <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (2.0 * (cos(k_m) * (l * l))) / ((((0.5 - (cos((k_m + k_m)) * 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 (k_m <= 1.7d-6) then
        tmp = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
    else
        tmp = (2.0d0 * (cos(k_m) * (l * l))) / ((((0.5d0 - (cos((k_m + k_m)) * 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 (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (2.0 * (Math.cos(k_m) * (l * l))) / ((((0.5 - (Math.cos((k_m + k_m)) * 0.5)) * t) * k_m) * k_m);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 1.7e-6:
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
	else:
		tmp = (2.0 * (math.cos(k_m) * (l * l))) / ((((0.5 - (math.cos((k_m + k_m)) * 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 <= 1.7e-6)
		tmp = Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)));
	else
		tmp = Float64(Float64(2.0 * Float64(cos(k_m) * Float64(l * l))) / Float64(Float64(Float64(Float64(0.5 - Float64(cos(Float64(k_m + k_m)) * 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 (k_m <= 1.7e-6)
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	else
		tmp = (2.0 * (cos(k_m) * (l * l))) / ((((0.5 - (cos((k_m + k_m)) * 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[k$95$m, 1.7e-6], N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[Cos[k$95$m], $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(0.5 - N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\cos k\_m \cdot \left(\ell \cdot \ell\right)\right)}{\left(\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 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 < 1.70000000000000003e-6

    1. Initial program 42.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in k around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
      8. pow-prod-upN/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
      10. unpow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
      12. unpow2N/A

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      13. lower-*.f6474.0

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      3. pow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
      5. unpow-prod-downN/A

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
      12. lift-*.f6476.4

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
    8. Applied rewrites76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
      17. times-fracN/A

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

        \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
    10. Applied rewrites93.4%

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

    if 1.70000000000000003e-6 < k

    1. Initial program 29.8%

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

        \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.7% accurate, 1.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\cos k\_m \cdot \ell\right) \cdot \ell\right) \cdot 2}{\left(\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 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 1.7e-6)
   (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m)))
   (/
    (* (* (* (cos k_m) l) l) 2.0)
    (* (* (* (- 0.5 (* (cos (+ k_m k_m)) 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 <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((cos(k_m) * l) * l) * 2.0) / ((((0.5 - (cos((k_m + k_m)) * 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 (k_m <= 1.7d-6) then
        tmp = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
    else
        tmp = (((cos(k_m) * l) * l) * 2.0d0) / ((((0.5d0 - (cos((k_m + k_m)) * 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 (k_m <= 1.7e-6) {
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	} else {
		tmp = (((Math.cos(k_m) * l) * l) * 2.0) / ((((0.5 - (Math.cos((k_m + k_m)) * 0.5)) * t) * k_m) * k_m);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 1.7e-6:
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
	else:
		tmp = (((math.cos(k_m) * l) * l) * 2.0) / ((((0.5 - (math.cos((k_m + k_m)) * 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 <= 1.7e-6)
		tmp = Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)));
	else
		tmp = Float64(Float64(Float64(Float64(cos(k_m) * l) * l) * 2.0) / Float64(Float64(Float64(Float64(0.5 - Float64(cos(Float64(k_m + k_m)) * 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 (k_m <= 1.7e-6)
		tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
	else
		tmp = (((cos(k_m) * l) * l) * 2.0) / ((((0.5 - (cos((k_m + k_m)) * 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[k$95$m, 1.7e-6], N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(N[(N[(0.5 - N[(N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\cos k\_m \cdot \ell\right) \cdot \ell\right) \cdot 2}{\left(\left(\left(0.5 - \cos \left(k\_m + k\_m\right) \cdot 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 < 1.70000000000000003e-6

    1. Initial program 42.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Taylor expanded in k around 0

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
      8. pow-prod-upN/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
      10. unpow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
      12. unpow2N/A

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      13. lower-*.f6474.0

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
      3. pow2N/A

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
      5. unpow-prod-downN/A

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
      12. lift-*.f6476.4

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
    8. Applied rewrites76.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
      17. times-fracN/A

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

        \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
    10. Applied rewrites93.4%

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

    if 1.70000000000000003e-6 < k

    1. Initial program 29.8%

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

        \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
      3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

Alternative 6: 72.8% accurate, 5.6× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2 \cdot \ell}{\left(k\_m \cdot t\right) \cdot k\_m} \cdot \frac{\ell}{k\_m \cdot k\_m} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (* (/ (* 2.0 l) (* (* k_m t) k_m)) (/ l (* k_m k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
}
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 = ((2.0d0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(Float64(2.0 * l) / Float64(Float64(k_m * t) * k_m)) * Float64(l / Float64(k_m * k_m)))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = ((2.0 * l) / ((k_m * t) * k_m)) * (l / (k_m * k_m));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(N[(2.0 * l), $MachinePrecision] / N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Taylor expanded in k around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
    8. pow-prod-upN/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
    10. unpow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
    12. unpow2N/A

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    13. lower-*.f6462.5

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    3. pow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
    5. unpow-prod-downN/A

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
    12. lift-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
  6. Applied rewrites64.0%

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \color{blue}{\left(k \cdot t\right)}\right)} \]
    5. lower-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
  8. Applied rewrites64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(2 \cdot \ell\right) \cdot \ell}{\left({k}^{2} \cdot t\right) \cdot {k}^{2}} \]
    17. times-fracN/A

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

      \[\leadsto \frac{2 \cdot \ell}{{k}^{2} \cdot t} \cdot \color{blue}{\frac{\ell}{{k}^{2}}} \]
  10. Applied rewrites72.8%

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

Alternative 7: 72.1% accurate, 5.6× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2 \cdot \ell}{k\_m} \cdot \frac{\ell}{k\_m \cdot \left(\left(k\_m \cdot t\right) \cdot k\_m\right)} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (* (/ (* 2.0 l) k_m) (/ l (* k_m (* (* k_m t) k_m)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return ((2.0 * l) / k_m) * (l / (k_m * ((k_m * t) * k_m)));
}
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 = ((2.0d0 * l) / k_m) * (l / (k_m * ((k_m * t) * k_m)))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return ((2.0 * l) / k_m) * (l / (k_m * ((k_m * t) * k_m)));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return ((2.0 * l) / k_m) * (l / (k_m * ((k_m * t) * k_m)))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(Float64(2.0 * l) / k_m) * Float64(l / Float64(k_m * Float64(Float64(k_m * t) * k_m))))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = ((2.0 * l) / k_m) * (l / (k_m * ((k_m * t) * k_m)));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(N[(2.0 * l), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(l / N[(k$95$m * N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Taylor expanded in k around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
    8. pow-prod-upN/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
    10. unpow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
    12. unpow2N/A

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    13. lower-*.f6462.5

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    3. pow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
    5. unpow-prod-downN/A

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
    12. lift-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
  6. Applied rewrites64.0%

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \color{blue}{\left(k \cdot t\right)}\right)} \]
    5. lower-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
  8. Applied rewrites64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \ell}{k} \cdot \frac{\ell}{k \cdot \left(\left(k \cdot t\right) \cdot \color{blue}{k}\right)} \]
    22. lift-*.f6472.1

      \[\leadsto \frac{2 \cdot \ell}{k} \cdot \frac{\ell}{k \cdot \left(\left(k \cdot t\right) \cdot k\right)} \]
  10. Applied rewrites72.1%

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

Alternative 8: 65.1% accurate, 5.6× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2}{k\_m \cdot k\_m} \cdot \frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot t} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (* (/ 2.0 (* k_m k_m)) (/ (* l l) (* (* k_m k_m) t))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return (2.0 / (k_m * k_m)) * ((l * l) / ((k_m * k_m) * 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 = (2.0d0 / (k_m * k_m)) * ((l * l) / ((k_m * k_m) * t))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return (2.0 / (k_m * k_m)) * ((l * l) / ((k_m * k_m) * t));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return (2.0 / (k_m * k_m)) * ((l * l) / ((k_m * k_m) * t))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(2.0 / Float64(k_m * k_m)) * Float64(Float64(l * l) / Float64(Float64(k_m * k_m) * t)))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = (2.0 / (k_m * k_m)) * ((l * l) / ((k_m * k_m) * t));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(2.0 / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Taylor expanded in k around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
    8. pow-prod-upN/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
    10. unpow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
    12. unpow2N/A

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    13. lower-*.f6462.5

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    3. pow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
    5. unpow-prod-downN/A

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
    12. lift-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
  6. Applied rewrites64.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{{k}^{2}} \cdot \frac{{\ell}^{2}}{\left(k \cdot k\right) \cdot t} \]
    11. pow2N/A

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

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

      \[\leadsto \frac{2}{{k}^{2}} \cdot \frac{\color{blue}{{\ell}^{2}}}{{k}^{2} \cdot t} \]
    14. pow2N/A

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

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

      \[\leadsto \frac{2}{k \cdot k} \cdot \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot t}} \]
    17. pow2N/A

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

      \[\leadsto \frac{2}{k \cdot k} \cdot \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot t} \]
    19. pow2N/A

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

      \[\leadsto \frac{2}{k \cdot k} \cdot \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot t} \]
    21. lift-*.f6465.1

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

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

Alternative 9: 65.0% accurate, 5.6× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2}{k\_m} \cdot \frac{\ell \cdot \ell}{k\_m \cdot \left(\left(k\_m \cdot t\right) \cdot k\_m\right)} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (* (/ 2.0 k_m) (/ (* l l) (* k_m (* (* k_m t) k_m)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return (2.0 / k_m) * ((l * l) / (k_m * ((k_m * t) * k_m)));
}
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 = (2.0d0 / k_m) * ((l * l) / (k_m * ((k_m * t) * k_m)))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return (2.0 / k_m) * ((l * l) / (k_m * ((k_m * t) * k_m)));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return (2.0 / k_m) * ((l * l) / (k_m * ((k_m * t) * k_m)))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(2.0 / k_m) * Float64(Float64(l * l) / Float64(k_m * Float64(Float64(k_m * t) * k_m))))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = (2.0 / k_m) * ((l * l) / (k_m * ((k_m * t) * k_m)));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(2.0 / k$95$m), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / N[(k$95$m * N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Taylor expanded in k around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
    8. pow-prod-upN/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
    10. unpow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
    12. unpow2N/A

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    13. lower-*.f6462.5

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    3. pow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
    5. unpow-prod-downN/A

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
    12. lift-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
  6. Applied rewrites64.0%

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \color{blue}{\left(k \cdot t\right)}\right)} \]
    5. lower-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
  8. Applied rewrites64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{k} \cdot \frac{\ell \cdot \ell}{k \cdot \left(\left(k \cdot t\right) \cdot \color{blue}{k}\right)} \]
    23. lift-*.f6465.0

      \[\leadsto \frac{2}{k} \cdot \frac{\ell \cdot \ell}{k \cdot \left(\left(k \cdot t\right) \cdot k\right)} \]
  10. Applied rewrites65.0%

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

Alternative 10: 64.0% accurate, 5.7× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot \left(k\_m \cdot t\right)\right)} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (/ (* 2.0 (* l l)) (* (* k_m k_m) (* k_m (* k_m t)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return (2.0 * (l * l)) / ((k_m * k_m) * (k_m * (k_m * 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 = (2.0d0 * (l * l)) / ((k_m * k_m) * (k_m * (k_m * t)))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return (2.0 * (l * l)) / ((k_m * k_m) * (k_m * (k_m * t)));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return (2.0 * (l * l)) / ((k_m * k_m) * (k_m * (k_m * t)))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(2.0 * Float64(l * l)) / Float64(Float64(k_m * k_m) * Float64(k_m * Float64(k_m * t))))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = (2.0 * (l * l)) / ((k_m * k_m) * (k_m * (k_m * t)));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(2.0 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

    \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
  2. Taylor expanded in k around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{k}^{\left(2 + 2\right)} \cdot t} \]
    8. pow-prod-upN/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left({k}^{2} \cdot {k}^{2}\right) \cdot t} \]
    10. unpow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot {k}^{2}\right) \cdot t} \]
    12. unpow2N/A

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    13. lower-*.f6462.5

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot \left(k \cdot k\right)\right) \cdot t} \]
    3. pow2N/A

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{{\left(k \cdot k\right)}^{2} \cdot t} \]
    5. unpow-prod-downN/A

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

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
    12. lift-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)} \]
  6. Applied rewrites64.0%

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \color{blue}{\left(k \cdot t\right)}\right)} \]
    5. lower-*.f6464.0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot \left(k \cdot \left(k \cdot \color{blue}{t}\right)\right)} \]
  8. Applied rewrites64.0%

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

Alternative 11: 33.8% accurate, 5.8× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (/ (* 2.0 (* l l)) (* (* (- 0.5 0.5) t) (* k_m k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return (2.0 * (l * l)) / (((0.5 - 0.5) * t) * (k_m * k_m));
}
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 = (2.0d0 * (l * l)) / (((0.5d0 - 0.5d0) * t) * (k_m * k_m))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return (2.0 * (l * l)) / (((0.5 - 0.5) * t) * (k_m * k_m));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return (2.0 * (l * l)) / (((0.5 - 0.5) * t) * (k_m * k_m))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(2.0 * Float64(l * l)) / Float64(Float64(Float64(0.5 - 0.5) * t) * Float64(k_m * k_m)))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = (2.0 * (l * l)) / (((0.5 - 0.5) * t) * (k_m * k_m));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(2.0 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(0.5 - 0.5), $MachinePrecision] * t), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

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

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

      \[\leadsto \frac{2 \cdot \left({\ell}^{2} \cdot \cos k\right)}{\color{blue}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    3. lower-*.f64N/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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      2. lift-*.f6433.8

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    4. Applied rewrites33.8%

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(0.5 - 0.5\right) \cdot \color{blue}{t}\right) \cdot \left(k \cdot k\right)} \]
    5. Add Preprocessing

    Reproduce

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