Toniolo and Linder, Equation (10-)

Percentage Accurate: 34.8% → 90.7%
Time: 8.5s
Alternatives: 11
Speedup: 7.7×

Specification

?
\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 34.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

Alternative 1: 90.7% accurate, 1.2× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \left(\frac{\ell}{\sqrt{k\_m} \cdot \sqrt{k\_m}} \cdot \frac{\ell}{k\_m}\right) \cdot \frac{\cos k\_m \cdot 2}{t \cdot {\sin k\_m}^{2}} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (*
  (* (/ l (* (sqrt k_m) (sqrt k_m))) (/ l k_m))
  (/ (* (cos k_m) 2.0) (* t (pow (sin k_m) 2.0)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	return ((l / (sqrt(k_m) * sqrt(k_m))) * (l / k_m)) * ((cos(k_m) * 2.0) / (t * pow(sin(k_m), 2.0)));
}
k_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(t, l, k_m)
use fmin_fmax_functions
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: k_m
    code = ((l / (sqrt(k_m) * sqrt(k_m))) * (l / k_m)) * ((cos(k_m) * 2.0d0) / (t * (sin(k_m) ** 2.0d0)))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
	return ((l / (Math.sqrt(k_m) * Math.sqrt(k_m))) * (l / k_m)) * ((Math.cos(k_m) * 2.0) / (t * Math.pow(Math.sin(k_m), 2.0)));
}
k_m = math.fabs(k)
def code(t, l, k_m):
	return ((l / (math.sqrt(k_m) * math.sqrt(k_m))) * (l / k_m)) * ((math.cos(k_m) * 2.0) / (t * math.pow(math.sin(k_m), 2.0)))
k_m = abs(k)
function code(t, l, k_m)
	return Float64(Float64(Float64(l / Float64(sqrt(k_m) * sqrt(k_m))) * Float64(l / k_m)) * Float64(Float64(cos(k_m) * 2.0) / Float64(t * (sin(k_m) ^ 2.0))))
end
k_m = abs(k);
function tmp = code(t, l, k_m)
	tmp = ((l / (sqrt(k_m) * sqrt(k_m))) * (l / k_m)) * ((cos(k_m) * 2.0) / (t * (sin(k_m) ^ 2.0)));
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := N[(N[(N[(l / N[(N[Sqrt[k$95$m], $MachinePrecision] * N[Sqrt[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k$95$m], $MachinePrecision] * 2.0), $MachinePrecision] / N[(t * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|

\\
\left(\frac{\ell}{\sqrt{k\_m} \cdot \sqrt{k\_m}} \cdot \frac{\ell}{k\_m}\right) \cdot \frac{\cos k\_m \cdot 2}{t \cdot {\sin k\_m}^{2}}
\end{array}
Derivation
  1. Initial program 34.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. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{\ell}{\sqrt{k} \cdot \sqrt{k}} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k \cdot 2}{t \cdot {\sin k}^{2}} \]
    4. lower-sqrt.f6490.7

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

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

Alternative 2: 70.8% accurate, 0.6× speedup?

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t}\right)}^{2}\right) - 1\right)} \leq -1 \cdot 10^{-10}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t \cdot t\right) \cdot t}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \frac{k\_m \cdot k\_m}{t \cdot t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -1.00000000000000004e-10

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{{t}^{3}}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
      2. unpow3N/A

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

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

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

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{\left(t \cdot t\right)} \cdot t}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
      6. lift-*.f6466.4

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{\left(t \cdot t\right)} \cdot t}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
    6. Applied rewrites66.4%

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

    if -1.00000000000000004e-10 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))))

    1. Initial program 27.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\ell}{\sqrt{k} \cdot \sqrt{k}} \cdot \frac{\ell}{k}\right) \cdot \frac{\cos k \cdot 2}{t \cdot {\sin k}^{2}} \]
      4. lower-sqrt.f6489.5

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

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

      \[\leadsto \left(\frac{\ell}{\sqrt{k} \cdot \sqrt{k}} \cdot \frac{\ell}{k}\right) \cdot \frac{2}{\color{blue}{t} \cdot {\sin k}^{2}} \]
    12. Step-by-step derivation
      1. add-sqr-sqrt71.4

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

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

Alternative 3: 70.8% accurate, 0.6× speedup?

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t}\right)}^{2}\right) - 1\right)} \leq -1 \cdot 10^{-10}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t \cdot t\right) \cdot t}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \frac{k\_m \cdot k\_m}{t \cdot t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -1.00000000000000004e-10

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{{t}^{3}}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
      2. unpow3N/A

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

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

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

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{\left(t \cdot t\right)} \cdot t}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
      6. lift-*.f6466.4

        \[\leadsto \frac{2}{\left(\left(\frac{\color{blue}{\left(t \cdot t\right)} \cdot t}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \frac{k \cdot k}{t \cdot t}} \]
    6. Applied rewrites66.4%

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

    if -1.00000000000000004e-10 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))))

    1. Initial program 27.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{2}{\color{blue}{t} \cdot {\sin k}^{2}} \]
    10. Recombined 2 regimes into one program.
    11. Add Preprocessing

    Alternative 4: 73.5% accurate, 0.6× speedup?

    \[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} t_1 := \frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}\\ \mathbf{if}\;\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t}\right)}^{2}\right) - 1\right)} \leq -1 \cdot 10^{-10}:\\ \;\;\;\;t\_1 \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k\_m \cdot k\_m}{t}, 2 \cdot {t}^{-1}\right)}{k\_m \cdot k\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{2}{t \cdot {\sin k\_m}^{2}}\\ \end{array} \end{array} \]
    k_m = (fabs.f64 k)
    (FPCore (t l k_m)
     :precision binary64
     (let* ((t_1 (* (/ l k_m) (/ l k_m))))
       (if (<=
            (/
             2.0
             (*
              (* (* (/ (pow t 3.0) (* l l)) (sin k_m)) (tan k_m))
              (- (+ 1.0 (pow (/ k_m t) 2.0)) 1.0)))
            -1e-10)
         (*
          t_1
          (/
           (fma -0.3333333333333333 (/ (* k_m k_m) t) (* 2.0 (pow t -1.0)))
           (* k_m k_m)))
         (* t_1 (/ 2.0 (* t (pow (sin k_m) 2.0)))))))
    k_m = fabs(k);
    double code(double t, double l, double k_m) {
    	double t_1 = (l / k_m) * (l / k_m);
    	double tmp;
    	if ((2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t), 2.0)) - 1.0))) <= -1e-10) {
    		tmp = t_1 * (fma(-0.3333333333333333, ((k_m * k_m) / t), (2.0 * pow(t, -1.0))) / (k_m * k_m));
    	} else {
    		tmp = t_1 * (2.0 / (t * pow(sin(k_m), 2.0)));
    	}
    	return tmp;
    }
    
    k_m = abs(k)
    function code(t, l, k_m)
    	t_1 = Float64(Float64(l / k_m) * Float64(l / k_m))
    	tmp = 0.0
    	if (Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t) ^ 2.0)) - 1.0))) <= -1e-10)
    		tmp = Float64(t_1 * Float64(fma(-0.3333333333333333, Float64(Float64(k_m * k_m) / t), Float64(2.0 * (t ^ -1.0))) / Float64(k_m * k_m)));
    	else
    		tmp = Float64(t_1 * Float64(2.0 / Float64(t * (sin(k_m) ^ 2.0))));
    	end
    	return tmp
    end
    
    k_m = N[Abs[k], $MachinePrecision]
    code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(N[(l / k$95$m), $MachinePrecision] * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-10], N[(t$95$1 * N[(N[(-0.3333333333333333 * N[(N[(k$95$m * k$95$m), $MachinePrecision] / t), $MachinePrecision] + N[(2.0 * N[Power[t, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(2.0 / N[(t * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    k_m = \left|k\right|
    
    \\
    \begin{array}{l}
    t_1 := \frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}\\
    \mathbf{if}\;\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t}\right)}^{2}\right) - 1\right)} \leq -1 \cdot 10^{-10}:\\
    \;\;\;\;t\_1 \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k\_m \cdot k\_m}{t}, 2 \cdot {t}^{-1}\right)}{k\_m \cdot k\_m}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1 \cdot \frac{2}{t \cdot {\sin k\_m}^{2}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -1.00000000000000004e-10

      1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
        6. lower-*.f64N/A

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
        7. inv-powN/A

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

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

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
        10. lift-*.f6488.0

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
      10. Applied rewrites88.0%

        \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{\color{blue}{k \cdot k}} \]

      if -1.00000000000000004e-10 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (-.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))))

      1. Initial program 27.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{2}{\color{blue}{t} \cdot {\sin k}^{2}} \]
      10. Recombined 2 regimes into one program.
      11. Add Preprocessing

      Alternative 5: 80.6% accurate, 1.3× speedup?

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

        1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
          6. lower-*.f64N/A

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
          7. inv-powN/A

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

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

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
          10. lift-*.f6490.2

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
        10. Applied rewrites90.2%

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{\color{blue}{k \cdot k}} \]

        if 1.19999999999999997e-15 < k

        1. Initial program 29.4%

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

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

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

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

      Alternative 6: 90.8% accurate, 1.3× speedup?

      \[\begin{array}{l} k_m = \left|k\right| \\ \left(\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}\right) \cdot \frac{\cos k\_m \cdot 2}{t \cdot {\sin k\_m}^{2}} \end{array} \]
      k_m = (fabs.f64 k)
      (FPCore (t l k_m)
       :precision binary64
       (* (* (/ l k_m) (/ l k_m)) (/ (* (cos k_m) 2.0) (* t (pow (sin k_m) 2.0)))))
      k_m = fabs(k);
      double code(double t, double l, double k_m) {
      	return ((l / k_m) * (l / k_m)) * ((cos(k_m) * 2.0) / (t * pow(sin(k_m), 2.0)));
      }
      
      k_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(t, l, k_m)
      use fmin_fmax_functions
          real(8), intent (in) :: t
          real(8), intent (in) :: l
          real(8), intent (in) :: k_m
          code = ((l / k_m) * (l / k_m)) * ((cos(k_m) * 2.0d0) / (t * (sin(k_m) ** 2.0d0)))
      end function
      
      k_m = Math.abs(k);
      public static double code(double t, double l, double k_m) {
      	return ((l / k_m) * (l / k_m)) * ((Math.cos(k_m) * 2.0) / (t * Math.pow(Math.sin(k_m), 2.0)));
      }
      
      k_m = math.fabs(k)
      def code(t, l, k_m):
      	return ((l / k_m) * (l / k_m)) * ((math.cos(k_m) * 2.0) / (t * math.pow(math.sin(k_m), 2.0)))
      
      k_m = abs(k)
      function code(t, l, k_m)
      	return Float64(Float64(Float64(l / k_m) * Float64(l / k_m)) * Float64(Float64(cos(k_m) * 2.0) / Float64(t * (sin(k_m) ^ 2.0))))
      end
      
      k_m = abs(k);
      function tmp = code(t, l, k_m)
      	tmp = ((l / k_m) * (l / k_m)) * ((cos(k_m) * 2.0) / (t * (sin(k_m) ^ 2.0)));
      end
      
      k_m = N[Abs[k], $MachinePrecision]
      code[t_, l_, k$95$m_] := N[(N[(N[(l / k$95$m), $MachinePrecision] * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k$95$m], $MachinePrecision] * 2.0), $MachinePrecision] / N[(t * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      k_m = \left|k\right|
      
      \\
      \left(\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}\right) \cdot \frac{\cos k\_m \cdot 2}{t \cdot {\sin k\_m}^{2}}
      \end{array}
      
      Derivation
      1. Initial program 34.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. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 7: 75.3% accurate, 1.3× speedup?

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

        1. Initial program 32.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 2.05000000000000001e-160 < l

        1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{{\ell}^{2} \cdot \left(\cos k \cdot \left(\sqrt{2} \cdot \sqrt{2}\right)\right)}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \]
          3. add-sqr-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 73.1% accurate, 2.5× speedup?

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

        1. Initial program 39.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
          6. lower-*.f64N/A

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot \frac{1}{t}\right)}{{k}^{2}} \]
          7. inv-powN/A

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

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

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
          10. lift-*.f6489.5

            \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{k \cdot k} \]
        10. Applied rewrites89.5%

          \[\leadsto \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, \frac{k \cdot k}{t}, 2 \cdot {t}^{-1}\right)}{\color{blue}{k \cdot k}} \]

        if 110 < k

        1. Initial program 29.9%

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

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

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

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

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

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

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

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

      Alternative 9: 73.0% accurate, 2.9× speedup?

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

        1. Initial program 39.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.19999999999999996 < k

        1. Initial program 29.9%

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

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

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

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

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

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

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

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

      Alternative 10: 71.4% accurate, 7.7× speedup?

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

        1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.4e22 < k

        1. Initial program 30.4%

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{{k}^{2}}{t}, \frac{1}{t}\right)}{{k}^{2}}\right) \cdot 2 \]
          3. lower-/.f64N/A

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

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

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

            \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{{k}^{2}}\right) \cdot 2 \]
          7. lower-pow.f64N/A

            \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{{k}^{2}}\right) \cdot 2 \]
          8. pow2N/A

            \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
          9. lift-*.f6418.3

            \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
        7. Applied rewrites18.3%

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
        8. Taylor expanded in k around inf

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\frac{-1}{6}}{t}\right) \cdot 2 \]
        9. Step-by-step derivation
          1. lower-/.f6454.0

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

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

      Alternative 11: 28.6% accurate, 10.7× speedup?

      \[\begin{array}{l} k_m = \left|k\right| \\ \left(\frac{\ell \cdot \ell}{k\_m \cdot k\_m} \cdot \frac{-0.16666666666666666}{t}\right) \cdot 2 \end{array} \]
      k_m = (fabs.f64 k)
      (FPCore (t l k_m)
       :precision binary64
       (* (* (/ (* l l) (* k_m k_m)) (/ -0.16666666666666666 t)) 2.0))
      k_m = fabs(k);
      double code(double t, double l, double k_m) {
      	return (((l * l) / (k_m * k_m)) * (-0.16666666666666666 / t)) * 2.0;
      }
      
      k_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(t, l, k_m)
      use fmin_fmax_functions
          real(8), intent (in) :: t
          real(8), intent (in) :: l
          real(8), intent (in) :: k_m
          code = (((l * l) / (k_m * k_m)) * ((-0.16666666666666666d0) / t)) * 2.0d0
      end function
      
      k_m = Math.abs(k);
      public static double code(double t, double l, double k_m) {
      	return (((l * l) / (k_m * k_m)) * (-0.16666666666666666 / t)) * 2.0;
      }
      
      k_m = math.fabs(k)
      def code(t, l, k_m):
      	return (((l * l) / (k_m * k_m)) * (-0.16666666666666666 / t)) * 2.0
      
      k_m = abs(k)
      function code(t, l, k_m)
      	return Float64(Float64(Float64(Float64(l * l) / Float64(k_m * k_m)) * Float64(-0.16666666666666666 / t)) * 2.0)
      end
      
      k_m = abs(k);
      function tmp = code(t, l, k_m)
      	tmp = (((l * l) / (k_m * k_m)) * (-0.16666666666666666 / t)) * 2.0;
      end
      
      k_m = N[Abs[k], $MachinePrecision]
      code[t_, l_, k$95$m_] := N[(N[(N[(N[(l * l), $MachinePrecision] / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(-0.16666666666666666 / t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
      
      \begin{array}{l}
      k_m = \left|k\right|
      
      \\
      \left(\frac{\ell \cdot \ell}{k\_m \cdot k\_m} \cdot \frac{-0.16666666666666666}{t}\right) \cdot 2
      \end{array}
      
      Derivation
      1. Initial program 34.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. *-commutativeN/A

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

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

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

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

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

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{{k}^{2}}{t}, \frac{1}{t}\right)}{{k}^{2}}\right) \cdot 2 \]
        3. lower-/.f64N/A

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

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

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

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{{k}^{2}}\right) \cdot 2 \]
        7. lower-pow.f64N/A

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{{k}^{2}}\right) \cdot 2 \]
        8. pow2N/A

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(\frac{-1}{6}, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
        9. lift-*.f6448.5

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
      7. Applied rewrites48.5%

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\mathsf{fma}\left(-0.16666666666666666, \frac{k \cdot k}{t}, {t}^{-1}\right)}{k \cdot k}\right) \cdot 2 \]
      8. Taylor expanded in k around inf

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\frac{-1}{6}}{t}\right) \cdot 2 \]
      9. Step-by-step derivation
        1. lower-/.f6428.6

          \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{-0.16666666666666666}{t}\right) \cdot 2 \]
      10. Applied rewrites28.6%

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

      Reproduce

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