Toniolo and Linder, Equation (10-)

Percentage Accurate: 35.8% → 90.5%
Time: 8.0s
Alternatives: 13
Speedup: 4.4×

Specification

?
\[\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)} \]
(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]
\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)}

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

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

Initial Program: 35.8% accurate, 1.0× speedup?

\[\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)} \]
(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]
\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)}

Alternative 1: 90.5% accurate, 1.1× speedup?

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

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


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

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({\sin k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
      10. lower-pow.f6485.9%

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

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

    if 5.0000000000000001e26 < k

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.5% accurate, 1.2× speedup?

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

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


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

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    8. Step-by-step derivation
      1. lower-pow.f6472.0%

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

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

    if 1.45e-4 < k

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.7% accurate, 1.2× speedup?

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

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


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

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    8. Step-by-step derivation
      1. lower-pow.f6472.0%

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

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

    if 1.45e-4 < k

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.8% accurate, 1.2× speedup?

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

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


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

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    8. Step-by-step derivation
      1. lower-pow.f6472.0%

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

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

    if 1.45e-4 < k

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.8% accurate, 1.2× speedup?

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

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


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

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
    8. Step-by-step derivation
      1. lower-pow.f6472.0%

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

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

    if 1.45e-4 < k

    1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({\sin k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
      10. lower-pow.f6485.9%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 72.0% accurate, 1.8× speedup?

\[2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
(FPCore (t l k)
 :precision binary64
 (* 2.0 (* l (* l (/ (cos k) (* (* (* (pow k 2.0) t) k) k))))))
double code(double t, double l, double k) {
	return 2.0 * (l * (l * (cos(k) / (((pow(k, 2.0) * t) * k) * k))));
}
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 * (l * (l * (cos(k) / ((((k ** 2.0d0) * t) * k) * k))))
end function
public static double code(double t, double l, double k) {
	return 2.0 * (l * (l * (Math.cos(k) / (((Math.pow(k, 2.0) * t) * k) * k))));
}
def code(t, l, k):
	return 2.0 * (l * (l * (math.cos(k) / (((math.pow(k, 2.0) * t) * k) * k))))
function code(t, l, k)
	return Float64(2.0 * Float64(l * Float64(l * Float64(cos(k) / Float64(Float64(Float64((k ^ 2.0) * t) * k) * k)))))
end
function tmp = code(t, l, k)
	tmp = 2.0 * (l * (l * (cos(k) / ((((k ^ 2.0) * t) * k) * k))));
end
code[t_, l_, k_] := N[(2.0 * N[(l * N[(l * N[(N[Cos[k], $MachinePrecision] / N[(N[(N[(N[Power[k, 2.0], $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right)
Derivation
  1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left({k}^{2} \cdot t\right) \cdot k\right) \cdot k}\right)\right) \]
  8. Step-by-step derivation
    1. lower-pow.f6472.0%

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

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

Alternative 7: 71.1% accurate, 1.9× speedup?

\[2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left({k}^{3} \cdot t\right) \cdot k}\right)\right) \]
(FPCore (t l k)
 :precision binary64
 (* 2.0 (* l (* l (/ (cos k) (* (* (pow k 3.0) t) k))))))
double code(double t, double l, double k) {
	return 2.0 * (l * (l * (cos(k) / ((pow(k, 3.0) * t) * k))));
}
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 * (l * (l * (cos(k) / (((k ** 3.0d0) * t) * k))))
end function
public static double code(double t, double l, double k) {
	return 2.0 * (l * (l * (Math.cos(k) / ((Math.pow(k, 3.0) * t) * k))));
}
def code(t, l, k):
	return 2.0 * (l * (l * (math.cos(k) / ((math.pow(k, 3.0) * t) * k))))
function code(t, l, k)
	return Float64(2.0 * Float64(l * Float64(l * Float64(cos(k) / Float64(Float64((k ^ 3.0) * t) * k)))))
end
function tmp = code(t, l, k)
	tmp = 2.0 * (l * (l * (cos(k) / (((k ^ 3.0) * t) * k))));
end
code[t_, l_, k_] := N[(2.0 * N[(l * N[(l * N[(N[Cos[k], $MachinePrecision] / N[(N[(N[Power[k, 3.0], $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left({k}^{3} \cdot t\right) \cdot k}\right)\right)
Derivation
  1. Initial program 35.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left({k}^{3} \cdot t\right) \cdot k}\right)\right) \]
    2. lower-pow.f6471.1%

      \[\leadsto 2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left({k}^{3} \cdot t\right) \cdot k}\right)\right) \]
  9. Applied rewrites71.1%

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

Alternative 8: 69.4% accurate, 4.4× speedup?

\[\left(\ell \cdot \frac{\ell \cdot {k}^{-4}}{t}\right) \cdot 2 \]
(FPCore (t l k) :precision binary64 (* (* l (/ (* l (pow k -4.0)) t)) 2.0))
double code(double t, double l, double k) {
	return (l * ((l * pow(k, -4.0)) / t)) * 2.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 = (l * ((l * (k ** (-4.0d0))) / t)) * 2.0d0
end function
public static double code(double t, double l, double k) {
	return (l * ((l * Math.pow(k, -4.0)) / t)) * 2.0;
}
def code(t, l, k):
	return (l * ((l * math.pow(k, -4.0)) / t)) * 2.0
function code(t, l, k)
	return Float64(Float64(l * Float64(Float64(l * (k ^ -4.0)) / t)) * 2.0)
end
function tmp = code(t, l, k)
	tmp = (l * ((l * (k ^ -4.0)) / t)) * 2.0;
end
code[t_, l_, k_] := N[(N[(l * N[(N[(l * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
\left(\ell \cdot \frac{\ell \cdot {k}^{-4}}{t}\right) \cdot 2
Derivation
  1. Initial program 35.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 k around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\ell \cdot \frac{\frac{\ell}{{k}^{4}}}{t}\right) \cdot 2 \]
    5. mult-flipN/A

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot \frac{1}{{k}^{4}}}{t}\right) \cdot 2 \]
    6. inv-powN/A

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

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {\left({k}^{4}\right)}^{\left(\mathsf{neg}\left(1\right)\right)}}{t}\right) \cdot 2 \]
    8. lower-pow.f32N/A

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {\left({k}^{4}\right)}^{\left(\mathsf{neg}\left(1\right)\right)}}{t}\right) \cdot 2 \]
    9. lower-unsound-pow.f32N/A

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

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {\left({k}^{4}\right)}^{\left(\mathsf{neg}\left(1\right)\right)}}{t}\right) \cdot 2 \]
    11. lower-unsound-pow.f32N/A

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {\left({k}^{4}\right)}^{\left(\mathsf{neg}\left(1\right)\right)}}{t}\right) \cdot 2 \]
    12. lower-pow.f32N/A

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

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {\left({k}^{4}\right)}^{-1}}{t}\right) \cdot 2 \]
    14. inv-powN/A

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

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot \frac{1}{{k}^{4}}}{t}\right) \cdot 2 \]
    16. pow-flipN/A

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

      \[\leadsto \left(\ell \cdot \frac{\ell \cdot {k}^{\left(\mathsf{neg}\left(4\right)\right)}}{t}\right) \cdot 2 \]
    18. metadata-eval69.4%

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

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

Alternative 9: 68.9% accurate, 4.4× speedup?

\[\frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
(FPCore (t l k) :precision binary64 (* (/ (+ l l) (* (pow k 4.0) t)) l))
double code(double t, double l, double k) {
	return ((l + l) / (pow(k, 4.0) * t)) * l;
}
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 = ((l + l) / ((k ** 4.0d0) * t)) * l
end function
public static double code(double t, double l, double k) {
	return ((l + l) / (Math.pow(k, 4.0) * t)) * l;
}
def code(t, l, k):
	return ((l + l) / (math.pow(k, 4.0) * t)) * l
function code(t, l, k)
	return Float64(Float64(Float64(l + l) / Float64((k ^ 4.0) * t)) * l)
end
function tmp = code(t, l, k)
	tmp = ((l + l) / ((k ^ 4.0) * t)) * l;
end
code[t_, l_, k_] := N[(N[(N[(l + l), $MachinePrecision] / N[(N[Power[k, 4.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell
Derivation
  1. Initial program 35.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 k around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\ell + \ell}{{k}^{4} \cdot t} \cdot \ell \]
    11. lower-+.f6468.9%

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

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

Alternative 10: 35.8% accurate, 4.4× speedup?

\[\frac{2}{\left(\left(\left(\frac{k \cdot k}{\ell} \cdot t\right) \cdot t\right) \cdot \frac{t}{\ell}\right) \cdot \left(1 - 1\right)} \]
(FPCore (t l k)
 :precision binary64
 (/ 2.0 (* (* (* (* (/ (* k k) l) t) t) (/ t l)) (- 1.0 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((((k * k) / l) * t) * t) * (t / l)) * (1.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 / ((((((k * k) / l) * t) * t) * (t / l)) * (1.0d0 - 1.0d0))
end function
public static double code(double t, double l, double k) {
	return 2.0 / ((((((k * k) / l) * t) * t) * (t / l)) * (1.0 - 1.0));
}
def code(t, l, k):
	return 2.0 / ((((((k * k) / l) * t) * t) * (t / l)) * (1.0 - 1.0))
function code(t, l, k)
	return Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(k * k) / l) * t) * t) * Float64(t / l)) * Float64(1.0 - 1.0)))
end
function tmp = code(t, l, k)
	tmp = 2.0 / ((((((k * k) / l) * t) * t) * (t / l)) * (1.0 - 1.0));
end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision] * N[(1.0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{2}{\left(\left(\left(\frac{k \cdot k}{\ell} \cdot t\right) \cdot t\right) \cdot \frac{t}{\ell}\right) \cdot \left(1 - 1\right)}
Derivation
  1. Initial program 35.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 k around 0

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

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

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

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

      \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    5. lower-pow.f6434.0%

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

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

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

      \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    3. cube-multN/A

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

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

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

      \[\leadsto \frac{2}{\frac{\left({k}^{2} \cdot t\right) \cdot \left(t \cdot t\right)}{{\color{blue}{\ell}}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    7. lower-*.f6437.9%

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

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

      \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    10. lower-*.f6437.9%

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

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

      \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \color{blue}{\ell}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    13. lift-*.f6437.9%

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

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

    \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \ell} \cdot \left(\color{blue}{1} - 1\right)} \]
  8. Step-by-step derivation
    1. Applied rewrites26.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(\left(\frac{k \cdot k}{\ell} \cdot t\right) \cdot t\right) \cdot \frac{t}{\ell}\right) \cdot \left(1 - 1\right)} \]
      14. lower-/.f6435.8%

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

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

    Alternative 11: 31.1% accurate, 4.5× speedup?

    \[\frac{2}{\frac{\left(\left(\left(k \cdot k\right) \cdot t\right) \cdot t\right) \cdot t}{\ell \cdot \ell} \cdot \left(1 - 1\right)} \]
    (FPCore (t l k)
     :precision binary64
     (/ 2.0 (* (/ (* (* (* (* k k) t) t) t) (* l l)) (- 1.0 1.0))))
    double code(double t, double l, double k) {
    	return 2.0 / ((((((k * k) * t) * t) * t) / (l * l)) * (1.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 / ((((((k * k) * t) * t) * t) / (l * l)) * (1.0d0 - 1.0d0))
    end function
    
    public static double code(double t, double l, double k) {
    	return 2.0 / ((((((k * k) * t) * t) * t) / (l * l)) * (1.0 - 1.0));
    }
    
    def code(t, l, k):
    	return 2.0 / ((((((k * k) * t) * t) * t) / (l * l)) * (1.0 - 1.0))
    
    function code(t, l, k)
    	return Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(k * k) * t) * t) * t) / Float64(l * l)) * Float64(1.0 - 1.0)))
    end
    
    function tmp = code(t, l, k)
    	tmp = 2.0 / ((((((k * k) * t) * t) * t) / (l * l)) * (1.0 - 1.0));
    end
    
    code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(1.0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \frac{2}{\frac{\left(\left(\left(k \cdot k\right) \cdot t\right) \cdot t\right) \cdot t}{\ell \cdot \ell} \cdot \left(1 - 1\right)}
    
    Derivation
    1. Initial program 35.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 k around 0

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

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

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

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

        \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
      5. lower-pow.f6434.0%

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

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

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

        \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
      3. cube-multN/A

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

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

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

        \[\leadsto \frac{2}{\frac{\left({k}^{2} \cdot t\right) \cdot \left(t \cdot t\right)}{{\color{blue}{\ell}}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
      7. lower-*.f6437.9%

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

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

        \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
      10. lower-*.f6437.9%

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

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

        \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \color{blue}{\ell}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
      13. lift-*.f6437.9%

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

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

      \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \ell} \cdot \left(\color{blue}{1} - 1\right)} \]
    8. Step-by-step derivation
      1. Applied rewrites26.7%

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

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

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

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

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

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

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

      Alternative 12: 30.8% accurate, 4.5× speedup?

      \[\frac{2}{\left(\left(\left(\left(k \cdot k\right) \cdot t\right) \cdot t\right) \cdot \frac{t}{\ell \cdot \ell}\right) \cdot \left(1 - 1\right)} \]
      (FPCore (t l k)
       :precision binary64
       (/ 2.0 (* (* (* (* (* k k) t) t) (/ t (* l l))) (- 1.0 1.0))))
      double code(double t, double l, double k) {
      	return 2.0 / (((((k * k) * t) * t) * (t / (l * l))) * (1.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 / (((((k * k) * t) * t) * (t / (l * l))) * (1.0d0 - 1.0d0))
      end function
      
      public static double code(double t, double l, double k) {
      	return 2.0 / (((((k * k) * t) * t) * (t / (l * l))) * (1.0 - 1.0));
      }
      
      def code(t, l, k):
      	return 2.0 / (((((k * k) * t) * t) * (t / (l * l))) * (1.0 - 1.0))
      
      function code(t, l, k)
      	return Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k * k) * t) * t) * Float64(t / Float64(l * l))) * Float64(1.0 - 1.0)))
      end
      
      function tmp = code(t, l, k)
      	tmp = 2.0 / (((((k * k) * t) * t) * (t / (l * l))) * (1.0 - 1.0));
      end
      
      code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \frac{2}{\left(\left(\left(\left(k \cdot k\right) \cdot t\right) \cdot t\right) \cdot \frac{t}{\ell \cdot \ell}\right) \cdot \left(1 - 1\right)}
      
      Derivation
      1. Initial program 35.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 k around 0

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

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

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

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

          \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        5. lower-pow.f6434.0%

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

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

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

          \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        3. cube-multN/A

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

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

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

          \[\leadsto \frac{2}{\frac{\left({k}^{2} \cdot t\right) \cdot \left(t \cdot t\right)}{{\color{blue}{\ell}}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        7. lower-*.f6437.9%

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

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

          \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        10. lower-*.f6437.9%

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

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

          \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \color{blue}{\ell}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
        13. lift-*.f6437.9%

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

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

        \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \ell} \cdot \left(\color{blue}{1} - 1\right)} \]
      8. Step-by-step derivation
        1. Applied rewrites26.7%

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

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

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

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

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

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

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

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

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

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

        Alternative 13: 2.8% accurate, 4.5× speedup?

        \[\frac{-2}{\left(1 - 1\right) \cdot \left(k \cdot \left(\left(k \cdot t\right) \cdot \left(t \cdot \frac{t}{\ell \cdot \ell}\right)\right)\right)} \]
        (FPCore (t l k)
         :precision binary64
         (/ -2.0 (* (- 1.0 1.0) (* k (* (* k t) (* t (/ t (* l l))))))))
        double code(double t, double l, double k) {
        	return -2.0 / ((1.0 - 1.0) * (k * ((k * t) * (t * (t / (l * l))))));
        }
        
        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) / ((1.0d0 - 1.0d0) * (k * ((k * t) * (t * (t / (l * l))))))
        end function
        
        public static double code(double t, double l, double k) {
        	return -2.0 / ((1.0 - 1.0) * (k * ((k * t) * (t * (t / (l * l))))));
        }
        
        def code(t, l, k):
        	return -2.0 / ((1.0 - 1.0) * (k * ((k * t) * (t * (t / (l * l))))))
        
        function code(t, l, k)
        	return Float64(-2.0 / Float64(Float64(1.0 - 1.0) * Float64(k * Float64(Float64(k * t) * Float64(t * Float64(t / Float64(l * l)))))))
        end
        
        function tmp = code(t, l, k)
        	tmp = -2.0 / ((1.0 - 1.0) * (k * ((k * t) * (t * (t / (l * l))))));
        end
        
        code[t_, l_, k_] := N[(-2.0 / N[(N[(1.0 - 1.0), $MachinePrecision] * N[(k * N[(N[(k * t), $MachinePrecision] * N[(t * N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \frac{-2}{\left(1 - 1\right) \cdot \left(k \cdot \left(\left(k \cdot t\right) \cdot \left(t \cdot \frac{t}{\ell \cdot \ell}\right)\right)\right)}
        
        Derivation
        1. Initial program 35.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 k around 0

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

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

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

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

            \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
          5. lower-pow.f6434.0%

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

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

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

            \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {t}^{3}}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
          3. cube-multN/A

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

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

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

            \[\leadsto \frac{2}{\frac{\left({k}^{2} \cdot t\right) \cdot \left(t \cdot t\right)}{{\color{blue}{\ell}}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
          7. lower-*.f6437.9%

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

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

            \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{{\ell}^{2}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
          10. lower-*.f6437.9%

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

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

            \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \color{blue}{\ell}} \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
          13. lift-*.f6437.9%

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

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

          \[\leadsto \frac{2}{\frac{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(t \cdot t\right)}{\ell \cdot \ell} \cdot \left(\color{blue}{1} - 1\right)} \]
        8. Step-by-step derivation
          1. Applied rewrites26.7%

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

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

          Reproduce

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