Toniolo and Linder, Equation (10+)

Percentage Accurate: 55.2% → 91.1%
Time: 7.5s
Alternatives: 24
Speedup: 10.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 24 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: 55.2% 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: 91.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2 \cdot 10^{+141}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left({\left(\sin k\_m \cdot t\right)}^{2}, 2, {\left(\sin k\_m \cdot k\_m\right)}^{2}\right)}{\cos k\_m \cdot \ell} \cdot \frac{t}{\ell}}\\

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


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

    1. Initial program 58.3%

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

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000003e141 < k

    1. Initial program 46.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 rewrites63.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 61.5% accurate, 0.8× 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 2 \cdot 10^{+180}:\\ \;\;\;\;\frac{\ell \cdot \ell}{k\_m \cdot \left(k\_m \cdot {t}^{3}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 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)))
      2e+180)
   (/ (* l l) (* k_m (* k_m (pow t 3.0))))
   (* (/ (/ (* l l) t) (* (* k_m k_m) (* k_m 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))) <= 2e+180) {
		tmp = (l * l) / (k_m * (k_m * pow(t, 3.0)));
	} else {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2d+180) then
        tmp = (l * l) / (k_m * (k_m * (t ** 3.0d0)))
    else
        tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+180) {
		tmp = (l * l) / (k_m * (k_m * Math.pow(t, 3.0)));
	} else {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+180:
		tmp = (l * l) / (k_m * (k_m * math.pow(t, 3.0)))
	else:
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+180)
		tmp = Float64(Float64(l * l) / Float64(k_m * Float64(k_m * (t ^ 3.0))));
	else
		tmp = Float64(Float64(Float64(Float64(l * l) / t) / Float64(Float64(k_m * k_m) * Float64(k_m * 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))) <= 2e+180)
		tmp = (l * l) / (k_m * (k_m * (t ^ 3.0)));
	else
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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], 2e+180], N[(N[(l * l), $MachinePrecision] / N[(k$95$m * N[(k$95$m * N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $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 2 \cdot 10^{+180}:\\
\;\;\;\;\frac{\ell \cdot \ell}{k\_m \cdot \left(k\_m \cdot {t}^{3}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 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)))) < 2e180

    1. Initial program 80.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 k around 0

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6468.8

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{k \cdot \left(k \cdot \color{blue}{{t}^{3}}\right)} \]
      7. lift-pow.f6475.2

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

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

    if 2e180 < (/.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 22.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. *-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 rewrites56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 57.8% accurate, 0.9× 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 2 \cdot 10^{+117}:\\ \;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 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)))
      2e+117)
   (/ (* l l) (* (* k_m k_m) (* (* t t) t)))
   (* (/ (/ (* l l) t) (* (* k_m k_m) (* k_m 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))) <= 2e+117) {
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	} else {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2d+117) then
        tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
    else
        tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+117) {
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	} else {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+117:
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
	else:
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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))) <= 2e+117)
		tmp = Float64(Float64(l * l) / Float64(Float64(k_m * k_m) * Float64(Float64(t * t) * t)));
	else
		tmp = Float64(Float64(Float64(Float64(l * l) / t) / Float64(Float64(k_m * k_m) * Float64(k_m * 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))) <= 2e+117)
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	else
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * 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], 2e+117], N[(N[(l * l), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $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 2 \cdot 10^{+117}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 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)))) < 2.0000000000000001e117

    1. Initial program 80.6%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6468.9

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. lower-*.f6468.9

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

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

    if 2.0000000000000001e117 < (/.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 23.3%

      \[\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 rewrites56.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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      3. lift-*.f6443.9

        \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    12. Applied rewrites43.9%

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

Alternative 4: 78.1% accurate, 1.0× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 1.8499999999999999e-24

    1. Initial program 50.3%

      \[\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 rewrites63.6%

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

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

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

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

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

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

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

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

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

    if 1.8499999999999999e-24 < t < 1.5e85

    1. Initial program 76.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. Applied rewrites80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e85 < t

    1. Initial program 63.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      7. lift-pow.f6487.0

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

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

Alternative 5: 77.1% accurate, 1.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.7999999999999994e45

    1. Initial program 52.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. *-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 rewrites63.6%

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

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

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

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

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

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

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

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

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

    if 5.7999999999999994e45 < t

    1. Initial program 65.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 77.0% accurate, 1.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.5000000000000001e45

    1. Initial program 52.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. *-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 rewrites63.6%

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

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

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

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

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

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

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

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

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

    if 5.5000000000000001e45 < t

    1. Initial program 65.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      5. lower-*.f6484.6

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

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

Alternative 7: 72.4% accurate, 1.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 7.5999999999999998e28

    1. Initial program 52.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{\frac{{k}^{2} \cdot {\sin k}^{2}}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{2}{\frac{{\sin k}^{2} \cdot {k}^{2}}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      2. unpow-prod-downN/A

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

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

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

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

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

    if 7.5999999999999998e28 < t

    1. Initial program 65.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      5. lower-*.f6483.8

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

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

Alternative 8: 71.4% accurate, 1.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 7.5999999999999998e28

    1. Initial program 52.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    3. Step-by-step derivation
      1. *-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 rewrites63.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5999999999999998e28 < t

    1. Initial program 65.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      5. lower-*.f6483.8

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

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

Alternative 9: 68.7% accurate, 1.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 7.5999999999999998e28

    1. Initial program 52.0%

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

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    3. Step-by-step derivation
      1. *-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 rewrites63.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5999999999999998e28 < t

    1. Initial program 65.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      5. lower-*.f6483.8

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

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

Alternative 10: 77.6% accurate, 1.8× speedup?

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

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

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

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

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


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

    1. Initial program 62.1%

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

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k \cdot \ell} \cdot \frac{t}{\ell}} \]
      5. lower-*.f6485.0

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

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

    if 9.39999999999999945e-5 < k

    1. Initial program 48.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. *-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 rewrites68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right)} \]
      8. lower-*.f6470.5

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

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

Alternative 11: 77.6% accurate, 1.8× speedup?

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

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

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

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

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


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

    1. Initial program 62.1%

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

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.39999999999999945e-5 < k

    1. Initial program 48.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. *-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 rewrites68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right)} \]
      8. lower-*.f6470.5

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

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

Alternative 12: 61.8% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{t \cdot t}{\ell}\\
\mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\frac{2}{\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_1, -0.6666666666666666, {\ell}^{-1}\right) - \left(-t\_1\right), k\_m \cdot k\_m, t\_1 \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)\right) \cdot \frac{t}{\ell}}\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9999999999999998e-14 < t < 4.2000000000000002e60

    1. Initial program 79.3%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.4

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

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

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

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

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

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

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

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

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 4.2000000000000002e60 < t

    1. Initial program 64.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      6. lower-*.f6485.2

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

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

Alternative 13: 63.4% accurate, 2.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.6666666666666666, t \cdot t, 1\right), k\_m \cdot k\_m, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)}{\cos k\_m \cdot \ell} \cdot \frac{t}{\ell}}\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9999999999999998e-14 < t < 4.2000000000000002e60

    1. Initial program 79.3%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.4

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

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

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

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

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

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

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

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

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 4.2000000000000002e60 < t

    1. Initial program 64.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      6. lower-*.f6485.2

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

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

Alternative 14: 59.7% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.6666666666666666, t \cdot t, 1\right), k\_m \cdot k\_m, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)}{\cos k\_m \cdot \left(\ell \cdot \ell\right)} \cdot t}\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.6666666666666666, t \cdot t, 1\right), k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t} \]
    7. Applied rewrites51.0%

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

    if 2.9999999999999998e-14 < t < 4.2000000000000002e60

    1. Initial program 79.3%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.4

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

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

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

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

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

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

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

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

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 4.2000000000000002e60 < t

    1. Initial program 64.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      6. lower-*.f6485.2

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

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

Alternative 15: 64.7% accurate, 2.9× speedup?

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\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\\

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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. *-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 rewrites63.6%

      \[\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-*.f6458.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 rewrites58.0%

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

    if 2.9999999999999998e-14 < t < 4.2000000000000002e60

    1. Initial program 79.3%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.4

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

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

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

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

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

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

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

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

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 4.2000000000000002e60 < t

    1. Initial program 64.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      6. lower-*.f6485.2

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

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

Alternative 16: 63.7% accurate, 2.9× speedup?

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

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

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

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

\mathbf{elif}\;t \leq 4.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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. *-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 rewrites63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9999999999999998e-14 < t < 4.2000000000000002e60

    1. Initial program 79.3%

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.4

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot {\color{blue}{t}}^{3}} \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot {t}^{\color{blue}{3}}} \]
      7. pow2N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

        \[\leadsto \frac{\frac{{\ell}^{2}}{{k}^{2}}}{\color{blue}{{t}^{3}}} \]
      9. pow2N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{{k}^{2}}}{{t}^{3}} \]
      10. pow2N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{t}^{3}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{\color{blue}{t}}^{3}} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{\color{blue}{t}}^{3}} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 4.2000000000000002e60 < t

    1. Initial program 64.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 \frac{2}{\color{blue}{t \cdot \left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{2}{\left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right) \cdot \color{blue}{t}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{2}{\left(2 \cdot \frac{{t}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k} + \frac{{k}^{2} \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}\right) \cdot \color{blue}{t}} \]
    4. Applied rewrites77.4%

      \[\leadsto \frac{2}{\color{blue}{\frac{\mathsf{fma}\left(2, {\left(\sin k \cdot t\right)}^{2}, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}} \]
    5. Applied rewrites75.8%

      \[\leadsto \frac{2}{\frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\color{blue}{\left(\cos k \cdot \ell\right) \cdot \ell}}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{2}{\frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\color{blue}{\left(\cos k \cdot \ell\right) \cdot \ell}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{2}{\frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\color{blue}{\left(\cos k \cdot \ell\right)} \cdot \ell}} \]
      3. lift-fma.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\color{blue}{\cos k} \cdot \ell\right) \cdot \ell}} \]
      4. lift-pow.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      6. lift-sin.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      7. lift-pow.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      9. lift-sin.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \color{blue}{\ell}}} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      12. lift-cos.f64N/A

        \[\leadsto \frac{2}{\frac{\left({\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}} \]
      13. times-fracN/A

        \[\leadsto \frac{2}{\frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2 + {\left(\sin k \cdot k\right)}^{2}}{\cos k \cdot \ell} \cdot \color{blue}{\frac{t}{\ell}}} \]
    7. Applied rewrites89.5%

      \[\leadsto \frac{2}{\frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \ell} \cdot \color{blue}{\frac{t}{\ell}}} \]
    8. Taylor expanded in k around 0

      \[\leadsto \frac{2}{\left(2 \cdot \frac{{k}^{2} \cdot {t}^{2}}{\ell}\right) \cdot \frac{\color{blue}{t}}{\ell}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{2}{\left(\frac{{k}^{2} \cdot {t}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{2}{\left(\frac{{k}^{2} \cdot {t}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{2}{\left(\frac{{k}^{2} \cdot {t}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      4. pow-prod-downN/A

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
      6. lower-*.f6485.2

        \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{t}{\ell}} \]
    10. Applied rewrites85.2%

      \[\leadsto \frac{2}{\left(\frac{{\left(k \cdot t\right)}^{2}}{\ell} \cdot 2\right) \cdot \frac{\color{blue}{t}}{\ell}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 61.6% accurate, 3.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\ \;\;\;\;\frac{2 \cdot \left(\left(\cos k\_m \cdot \ell\right) \cdot \ell\right)}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)}\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{+60}:\\ \;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= t 3e-14)
   (/ (* 2.0 (* (* (cos k_m) l) l)) (* (* (* k_m k_m) t) (* k_m k_m)))
   (if (<= t 2.4e+60)
     (/ (* (/ l k_m) (/ l k_m)) (pow t 3.0))
     (/ (* l l) (* (pow (* k_m t) 2.0) t)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (t <= 3e-14) {
		tmp = (2.0 * ((cos(k_m) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m));
	} else if (t <= 2.4e+60) {
		tmp = ((l / k_m) * (l / k_m)) / pow(t, 3.0);
	} else {
		tmp = (l * l) / (pow((k_m * t), 2.0) * t);
	}
	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 (t <= 3d-14) then
        tmp = (2.0d0 * ((cos(k_m) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m))
    else if (t <= 2.4d+60) then
        tmp = ((l / k_m) * (l / k_m)) / (t ** 3.0d0)
    else
        tmp = (l * l) / (((k_m * t) ** 2.0d0) * t)
    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 (t <= 3e-14) {
		tmp = (2.0 * ((Math.cos(k_m) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m));
	} else if (t <= 2.4e+60) {
		tmp = ((l / k_m) * (l / k_m)) / Math.pow(t, 3.0);
	} else {
		tmp = (l * l) / (Math.pow((k_m * t), 2.0) * t);
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if t <= 3e-14:
		tmp = (2.0 * ((math.cos(k_m) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m))
	elif t <= 2.4e+60:
		tmp = ((l / k_m) * (l / k_m)) / math.pow(t, 3.0)
	else:
		tmp = (l * l) / (math.pow((k_m * t), 2.0) * t)
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (t <= 3e-14)
		tmp = Float64(Float64(2.0 * Float64(Float64(cos(k_m) * l) * l)) / Float64(Float64(Float64(k_m * k_m) * t) * Float64(k_m * k_m)));
	elseif (t <= 2.4e+60)
		tmp = Float64(Float64(Float64(l / k_m) * Float64(l / k_m)) / (t ^ 3.0));
	else
		tmp = Float64(Float64(l * l) / Float64((Float64(k_m * t) ^ 2.0) * t));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (t <= 3e-14)
		tmp = (2.0 * ((cos(k_m) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m));
	elseif (t <= 2.4e+60)
		tmp = ((l / k_m) * (l / k_m)) / (t ^ 3.0);
	else
		tmp = (l * l) / (((k_m * t) ^ 2.0) * t);
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[t, 3e-14], N[(N[(2.0 * N[(N[(N[Cos[k$95$m], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+60], N[(N[(N[(l / k$95$m), $MachinePrecision] * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision] / N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(l * l), $MachinePrecision] / N[(N[Power[N[(k$95$m * t), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3 \cdot 10^{-14}:\\
\;\;\;\;\frac{2 \cdot \left(\left(\cos k\_m \cdot \ell\right) \cdot \ell\right)}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)}\\

\mathbf{elif}\;t \leq 2.4 \cdot 10^{+60}:\\
\;\;\;\;\frac{\frac{\ell}{k\_m} \cdot \frac{\ell}{k\_m}}{{t}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 2.9999999999999998e-14

    1. Initial program 50.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. *-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 rewrites63.6%

      \[\leadsto \color{blue}{\left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot \color{blue}{2} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      5. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      6. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      7. lift-cos.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      8. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      9. lift-pow.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      10. lift-sin.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      11. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      12. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      13. frac-timesN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)} \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \cdot 2 \]
    6. Applied rewrites64.2%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\color{blue}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {\sin k}^{2}}} \]
    7. Taylor expanded in k around 0

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {k}^{\color{blue}{2}}} \]
    8. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      2. lift-*.f6456.5

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    9. Applied rewrites56.5%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot \color{blue}{k}\right)} \]

    if 2.9999999999999998e-14 < t < 2.4e60

    1. Initial program 79.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 k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6466.3

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites66.3%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot {t}^{3}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \color{blue}{{t}^{3}}} \]
      5. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot {\color{blue}{t}}^{3}} \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot {t}^{\color{blue}{3}}} \]
      7. pow2N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      8. associate-/r*N/A

        \[\leadsto \frac{\frac{{\ell}^{2}}{{k}^{2}}}{\color{blue}{{t}^{3}}} \]
      9. pow2N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{{k}^{2}}}{{t}^{3}} \]
      10. pow2N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{t}^{3}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k}}{\color{blue}{{t}^{3}}} \]
      12. times-fracN/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{\color{blue}{t}}^{3}} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{\color{blue}{t}}^{3}} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{3}} \]
      16. lift-pow.f6477.7

        \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{{t}^{\color{blue}{3}}} \]
    6. Applied rewrites77.7%

      \[\leadsto \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{\color{blue}{{t}^{3}}} \]

    if 2.4e60 < t

    1. Initial program 64.6%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    2. Taylor expanded in k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6455.2

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites55.2%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      2. unpow3N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      3. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. lower-*.f6455.2

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
    6. Applied rewrites55.2%

      \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \color{blue}{\left(\left(t \cdot t\right) \cdot t\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      3. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left({t}^{2} \cdot t\right)} \]
      7. associate-*r*N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      9. pow-prod-downN/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      11. lower-*.f6475.0

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
    8. Applied rewrites75.0%

      \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot \color{blue}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 18: 65.8% accurate, 3.3× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{{\left(\frac{\ell}{k\_m}\right)}^{2}}{t} \cdot -0.16666666666666666\right) \cdot 2\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 5.5e+15)
   (/ (* l l) (* (pow (* k_m t) 2.0) t))
   (* (* (/ (pow (/ l k_m) 2.0) t) -0.16666666666666666) 2.0)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (k_m <= 5.5e+15) {
		tmp = (l * l) / (pow((k_m * t), 2.0) * t);
	} else {
		tmp = ((pow((l / k_m), 2.0) / t) * -0.16666666666666666) * 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 <= 5.5d+15) then
        tmp = (l * l) / (((k_m * t) ** 2.0d0) * t)
    else
        tmp = ((((l / k_m) ** 2.0d0) / t) * (-0.16666666666666666d0)) * 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 <= 5.5e+15) {
		tmp = (l * l) / (Math.pow((k_m * t), 2.0) * t);
	} else {
		tmp = ((Math.pow((l / k_m), 2.0) / t) * -0.16666666666666666) * 2.0;
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 5.5e+15:
		tmp = (l * l) / (math.pow((k_m * t), 2.0) * t)
	else:
		tmp = ((math.pow((l / k_m), 2.0) / t) * -0.16666666666666666) * 2.0
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (k_m <= 5.5e+15)
		tmp = Float64(Float64(l * l) / Float64((Float64(k_m * t) ^ 2.0) * t));
	else
		tmp = Float64(Float64(Float64((Float64(l / k_m) ^ 2.0) / t) * -0.16666666666666666) * 2.0);
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (k_m <= 5.5e+15)
		tmp = (l * l) / (((k_m * t) ^ 2.0) * t);
	else
		tmp = ((((l / k_m) ^ 2.0) / t) * -0.16666666666666666) * 2.0;
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5.5e+15], N[(N[(l * l), $MachinePrecision] / N[(N[Power[N[(k$95$m * t), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / t), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{{\left(\frac{\ell}{k\_m}\right)}^{2}}{t} \cdot -0.16666666666666666\right) \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 5.5e15

    1. Initial program 61.8%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    2. Taylor expanded in k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6456.5

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites56.5%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      2. unpow3N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      3. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. lower-*.f6456.5

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
    6. Applied rewrites56.5%

      \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \color{blue}{\left(\left(t \cdot t\right) \cdot t\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      3. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left({t}^{2} \cdot t\right)} \]
      7. associate-*r*N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      9. pow-prod-downN/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      11. lower-*.f6472.0

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
    8. Applied rewrites72.0%

      \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot \color{blue}{t}} \]

    if 5.5e15 < k

    1. Initial program 47.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 rewrites68.5%

      \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    7. Applied rewrites20.2%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
    8. Taylor expanded in k around inf

      \[\leadsto \left(\frac{-1}{6} \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \cdot 2 \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{{\ell}^{2}}{{k}^{2} \cdot t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      2. lower-*.f64N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{{k}^{2} \cdot t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      3. associate-/r*N/A

        \[\leadsto \left(\frac{\frac{{\ell}^{2}}{{k}^{2}}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      4. lower-/.f64N/A

        \[\leadsto \left(\frac{\frac{{\ell}^{2}}{{k}^{2}}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      5. pow2N/A

        \[\leadsto \left(\frac{\frac{\ell \cdot \ell}{{k}^{2}}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      6. pow2N/A

        \[\leadsto \left(\frac{\frac{\ell \cdot \ell}{k \cdot k}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      7. times-fracN/A

        \[\leadsto \left(\frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      8. pow2N/A

        \[\leadsto \left(\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      9. lower-pow.f64N/A

        \[\leadsto \left(\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
      10. lower-/.f6459.0

        \[\leadsto \left(\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
    10. Applied rewrites59.0%

      \[\leadsto \left(\frac{{\left(\frac{\ell}{k}\right)}^{2}}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 65.2% accurate, 3.4× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= k_m 5.5e+15)
   (/ (* l l) (* (pow (* k_m t) 2.0) t))
   (* (/ (* -0.16666666666666666 (* l l)) (* (* 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 <= 5.5e+15) {
		tmp = (l * l) / (pow((k_m * t), 2.0) * t);
	} else {
		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * 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 <= 5.5d+15) then
        tmp = (l * l) / (((k_m * t) ** 2.0d0) * t)
    else
        tmp = (((-0.16666666666666666d0) * (l * l)) / ((k_m * k_m) * 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 <= 5.5e+15) {
		tmp = (l * l) / (Math.pow((k_m * t), 2.0) * t);
	} else {
		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * t)) * 2.0;
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if k_m <= 5.5e+15:
		tmp = (l * l) / (math.pow((k_m * t), 2.0) * t)
	else:
		tmp = ((-0.16666666666666666 * (l * l)) / ((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 <= 5.5e+15)
		tmp = Float64(Float64(l * l) / Float64((Float64(k_m * t) ^ 2.0) * t));
	else
		tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64(l * l)) / Float64(Float64(k_m * k_m) * 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 <= 5.5e+15)
		tmp = (l * l) / (((k_m * t) ^ 2.0) * t);
	else
		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * 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, 5.5e+15], N[(N[(l * l), $MachinePrecision] / N[(N[Power[N[(k$95$m * t), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\ell \cdot \ell}{{\left(k\_m \cdot t\right)}^{2} \cdot t}\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 5.5e15

    1. Initial program 61.8%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    2. Taylor expanded in k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6456.5

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites56.5%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      2. unpow3N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      3. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. lower-*.f6456.5

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
    6. Applied rewrites56.5%

      \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \color{blue}{\left(\left(t \cdot t\right) \cdot t\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      3. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\color{blue}{\left(t \cdot t\right)} \cdot t\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \left({t}^{2} \cdot t\right)} \]
      7. associate-*r*N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left({k}^{2} \cdot {t}^{2}\right) \cdot \color{blue}{t}} \]
      9. pow-prod-downN/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
      11. lower-*.f6472.0

        \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot t} \]
    8. Applied rewrites72.0%

      \[\leadsto \frac{\ell \cdot \ell}{{\left(k \cdot t\right)}^{2} \cdot \color{blue}{t}} \]

    if 5.5e15 < k

    1. Initial program 47.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 rewrites68.5%

      \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    7. Applied rewrites20.2%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
    8. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      2. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
      3. pow-prod-upN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      5. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      7. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      8. lift-*.f6420.2

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    9. Applied rewrites20.2%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    10. Taylor expanded in k around inf

      \[\leadsto \left(\frac{-1}{6} \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \cdot 2 \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      2. lower-/.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      4. pow2N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
      6. pow2N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      8. lift-*.f6457.8

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
    12. Applied rewrites57.8%

      \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 56.0% accurate, 3.4× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;t \leq 2.1 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \frac{\ell}{\left(k\_m \cdot k\_m\right) \cdot {t}^{3}}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (if (<= t 2.1e-8)
   (* (/ (/ (* l l) t) (* (* k_m k_m) (* k_m k_m))) 2.0)
   (* l (/ l (* (* k_m k_m) (pow t 3.0))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double tmp;
	if (t <= 2.1e-8) {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * k_m))) * 2.0;
	} else {
		tmp = l * (l / ((k_m * k_m) * pow(t, 3.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 (t <= 2.1d-8) then
        tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * k_m))) * 2.0d0
    else
        tmp = l * (l / ((k_m * k_m) * (t ** 3.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 (t <= 2.1e-8) {
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * k_m))) * 2.0;
	} else {
		tmp = l * (l / ((k_m * k_m) * Math.pow(t, 3.0)));
	}
	return tmp;
}
k_m = math.fabs(k)
def code(t, l, k_m):
	tmp = 0
	if t <= 2.1e-8:
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * k_m))) * 2.0
	else:
		tmp = l * (l / ((k_m * k_m) * math.pow(t, 3.0)))
	return tmp
k_m = abs(k)
function code(t, l, k_m)
	tmp = 0.0
	if (t <= 2.1e-8)
		tmp = Float64(Float64(Float64(Float64(l * l) / t) / Float64(Float64(k_m * k_m) * Float64(k_m * k_m))) * 2.0);
	else
		tmp = Float64(l * Float64(l / Float64(Float64(k_m * k_m) * (t ^ 3.0))));
	end
	return tmp
end
k_m = abs(k);
function tmp_2 = code(t, l, k_m)
	tmp = 0.0;
	if (t <= 2.1e-8)
		tmp = (((l * l) / t) / ((k_m * k_m) * (k_m * k_m))) * 2.0;
	else
		tmp = l * (l / ((k_m * k_m) * (t ^ 3.0)));
	end
	tmp_2 = tmp;
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := If[LessEqual[t, 2.1e-8], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(l * N[(l / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.1 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{\left(k\_m \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\ell \cdot \frac{\ell}{\left(k\_m \cdot k\_m\right) \cdot {t}^{3}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2.09999999999999994e-8

    1. Initial program 50.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. *-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 rewrites63.7%

      \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    7. Applied rewrites23.1%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
    8. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      2. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
      3. pow-prod-upN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      5. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      7. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      8. lift-*.f6423.1

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    9. Applied rewrites23.1%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    10. Taylor expanded in k around 0

      \[\leadsto \frac{\frac{{\ell}^{2}}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    11. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      3. lift-*.f6453.9

        \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    12. Applied rewrites53.9%

      \[\leadsto \frac{\frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]

    if 2.09999999999999994e-8 < t

    1. Initial program 67.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 k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6457.7

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites57.7%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right)} \cdot {t}^{3}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      3. associate-/l*N/A

        \[\leadsto \ell \cdot \color{blue}{\frac{\ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      4. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\frac{\ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      5. lift-*.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lift-*.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot \color{blue}{{t}^{3}}} \]
      7. pow2N/A

        \[\leadsto \ell \cdot \frac{\ell}{{k}^{2} \cdot {\color{blue}{t}}^{3}} \]
      8. lift-pow.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{{k}^{2} \cdot {t}^{\color{blue}{3}}} \]
      9. lower-/.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      10. pow2N/A

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      11. lift-pow.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      12. lift-*.f64N/A

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot \color{blue}{{t}^{3}}} \]
      13. lift-*.f6461.9

        \[\leadsto \ell \cdot \frac{\ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
    6. Applied rewrites61.9%

      \[\leadsto \ell \cdot \color{blue}{\frac{\ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 45.5% accurate, 5.0× speedup?

\[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} t_1 := \frac{\ell \cdot \ell}{t}\\ \mathbf{if}\;\ell \leq 1.35 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(t\_1 \cdot -0.16666666666666666\right) \cdot k\_m, k\_m, t\_1\right)}{k\_m \cdot k\_m}}{k\_m \cdot k\_m} \cdot 2\\ \mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+145}:\\ \;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(\left(\mathsf{fma}\left(-0.5, k\_m \cdot k\_m, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)}\\ \end{array} \end{array} \]
k_m = (fabs.f64 k)
(FPCore (t l k_m)
 :precision binary64
 (let* ((t_1 (/ (* l l) t)))
   (if (<= l 1.35e-112)
     (*
      (/
       (/ (fma (* (* t_1 -0.16666666666666666) k_m) k_m t_1) (* k_m k_m))
       (* k_m k_m))
      2.0)
     (if (<= l 6.8e+145)
       (/ (* l l) (* (* k_m k_m) (* (* t t) t)))
       (/
        (* 2.0 (* (* (fma -0.5 (* k_m k_m) 1.0) l) l))
        (* (* (* k_m k_m) t) (* k_m k_m)))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
	double t_1 = (l * l) / t;
	double tmp;
	if (l <= 1.35e-112) {
		tmp = ((fma(((t_1 * -0.16666666666666666) * k_m), k_m, t_1) / (k_m * k_m)) / (k_m * k_m)) * 2.0;
	} else if (l <= 6.8e+145) {
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	} else {
		tmp = (2.0 * ((fma(-0.5, (k_m * k_m), 1.0) * l) * l)) / (((k_m * k_m) * t) * (k_m * k_m));
	}
	return tmp;
}
k_m = abs(k)
function code(t, l, k_m)
	t_1 = Float64(Float64(l * l) / t)
	tmp = 0.0
	if (l <= 1.35e-112)
		tmp = Float64(Float64(Float64(fma(Float64(Float64(t_1 * -0.16666666666666666) * k_m), k_m, t_1) / Float64(k_m * k_m)) / Float64(k_m * k_m)) * 2.0);
	elseif (l <= 6.8e+145)
		tmp = Float64(Float64(l * l) / Float64(Float64(k_m * k_m) * Float64(Float64(t * t) * t)));
	else
		tmp = Float64(Float64(2.0 * Float64(Float64(fma(-0.5, Float64(k_m * k_m), 1.0) * l) * l)) / Float64(Float64(Float64(k_m * k_m) * t) * Float64(k_m * k_m)));
	end
	return tmp
end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[l, 1.35e-112], N[(N[(N[(N[(N[(N[(t$95$1 * -0.16666666666666666), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m + t$95$1), $MachinePrecision] / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[l, 6.8e+145], N[(N[(l * l), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(-0.5 * N[(k$95$m * k$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k_m = \left|k\right|

\\
\begin{array}{l}
t_1 := \frac{\ell \cdot \ell}{t}\\
\mathbf{if}\;\ell \leq 1.35 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(t\_1 \cdot -0.16666666666666666\right) \cdot k\_m, k\_m, t\_1\right)}{k\_m \cdot k\_m}}{k\_m \cdot k\_m} \cdot 2\\

\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+145}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\left(\mathsf{fma}\left(-0.5, k\_m \cdot k\_m, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < 1.35e-112

    1. Initial program 55.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 rewrites60.3%

      \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    7. Applied rewrites25.3%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
    8. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      2. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
      3. pow-prod-upN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      5. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      7. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      8. lift-*.f6425.3

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    9. Applied rewrites25.3%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    10. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      2. lift-fma.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      8. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      12. pow2N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{2} \cdot \left(k \cdot k\right)} \cdot 2 \]
      13. pow2N/A

        \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      14. associate-/r*N/A

        \[\leadsto \frac{\frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{2}}}{{k}^{2}} \cdot 2 \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\frac{\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{2}}}{{k}^{2}} \cdot 2 \]
    11. Applied rewrites41.3%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot k, k, \frac{\ell \cdot \ell}{t}\right)}{k \cdot k}}{k \cdot k} \cdot 2 \]

    if 1.35e-112 < l < 6.7999999999999998e145

    1. Initial program 65.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    2. Taylor expanded in k around 0

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
      2. pow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
      7. lift-pow.f6459.7

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
    4. Applied rewrites59.7%

      \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
    5. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      2. unpow3N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
      3. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
      5. unpow2N/A

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. lower-*.f6459.7

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
    6. Applied rewrites59.7%

      \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]

    if 6.7999999999999998e145 < l

    1. Initial program 35.0%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    2. Taylor expanded in t around 0

      \[\leadsto \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
    3. Step-by-step derivation
      1. *-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 rewrites52.6%

      \[\leadsto \color{blue}{\left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot \color{blue}{2} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      5. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      6. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      7. lift-cos.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      8. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      9. lift-pow.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      10. lift-sin.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      11. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      12. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      13. frac-timesN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)} \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \cdot 2 \]
    6. Applied rewrites52.4%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\color{blue}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {\sin k}^{2}}} \]
    7. Taylor expanded in k around 0

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {k}^{\color{blue}{2}}} \]
    8. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      2. lift-*.f6449.5

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    9. Applied rewrites49.5%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot \color{blue}{k}\right)} \]
    10. Taylor expanded in k around 0

      \[\leadsto \frac{2 \cdot \left(\left(\left(1 + \frac{-1}{2} \cdot {k}^{2}\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{2 \cdot \left(\left(\left(\frac{-1}{2} \cdot {k}^{2} + 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{2 \cdot \left(\left(\mathsf{fma}\left(\frac{-1}{2}, {k}^{2}, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      3. pow2N/A

        \[\leadsto \frac{2 \cdot \left(\left(\mathsf{fma}\left(\frac{-1}{2}, k \cdot k, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      4. lift-*.f6444.1

        \[\leadsto \frac{2 \cdot \left(\left(\mathsf{fma}\left(-0.5, k \cdot k, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    12. Applied rewrites44.1%

      \[\leadsto \frac{2 \cdot \left(\left(\mathsf{fma}\left(-0.5, k \cdot k, 1\right) \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 22: 58.4% accurate, 9.4× 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.55 \cdot 10^{-162}:\\ \;\;\;\;\frac{2 \cdot \left(\ell \cdot \ell\right)}{t\_1 \cdot \left(k\_m \cdot k\_m\right)}\\ \mathbf{elif}\;k\_m \leq 5.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{t\_1} \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.55e-162)
     (/ (* 2.0 (* l l)) (* t_1 (* k_m k_m)))
     (if (<= k_m 5.5e+15)
       (/ (* l l) (* (* k_m k_m) (* (* t t) t)))
       (* (/ (* -0.16666666666666666 (* l l)) 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.55e-162) {
		tmp = (2.0 * (l * l)) / (t_1 * (k_m * k_m));
	} else if (k_m <= 5.5e+15) {
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	} else {
		tmp = ((-0.16666666666666666 * (l * l)) / 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.55d-162) then
        tmp = (2.0d0 * (l * l)) / (t_1 * (k_m * k_m))
    else if (k_m <= 5.5d+15) then
        tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
    else
        tmp = (((-0.16666666666666666d0) * (l * l)) / 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.55e-162) {
		tmp = (2.0 * (l * l)) / (t_1 * (k_m * k_m));
	} else if (k_m <= 5.5e+15) {
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	} else {
		tmp = ((-0.16666666666666666 * (l * l)) / 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.55e-162:
		tmp = (2.0 * (l * l)) / (t_1 * (k_m * k_m))
	elif k_m <= 5.5e+15:
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
	else:
		tmp = ((-0.16666666666666666 * (l * l)) / 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.55e-162)
		tmp = Float64(Float64(2.0 * Float64(l * l)) / Float64(t_1 * Float64(k_m * k_m)));
	elseif (k_m <= 5.5e+15)
		tmp = Float64(Float64(l * l) / Float64(Float64(k_m * k_m) * Float64(Float64(t * t) * t)));
	else
		tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64(l * l)) / 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.55e-162)
		tmp = (2.0 * (l * l)) / (t_1 * (k_m * k_m));
	elseif (k_m <= 5.5e+15)
		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
	else
		tmp = ((-0.16666666666666666 * (l * l)) / 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.55e-162], N[(N[(2.0 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k$95$m, 5.5e+15], N[(N[(l * l), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] / t$95$1), $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.55 \cdot 10^{-162}:\\
\;\;\;\;\frac{2 \cdot \left(\ell \cdot \ell\right)}{t\_1 \cdot \left(k\_m \cdot k\_m\right)}\\

\mathbf{elif}\;k\_m \leq 5.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{t\_1} \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if k < 1.5499999999999999e-162

    1. Initial program 62.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. *-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 rewrites51.3%

      \[\leadsto \color{blue}{\left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot \color{blue}{2} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      5. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      6. lift-/.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      7. lift-cos.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      8. lift-*.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      9. lift-pow.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      10. lift-sin.f64N/A

        \[\leadsto \left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      11. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      12. pow2N/A

        \[\leadsto \left(\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      13. frac-timesN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)} \cdot 2 \]
      14. *-commutativeN/A

        \[\leadsto \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)} \cdot 2 \]
    6. Applied rewrites51.3%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\color{blue}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {\sin k}^{2}}} \]
    7. Taylor expanded in k around 0

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot {k}^{\color{blue}{2}}} \]
    8. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
      2. lift-*.f6451.3

        \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    9. Applied rewrites51.3%

      \[\leadsto \frac{2 \cdot \left(\left(\cos k \cdot \ell\right) \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot \color{blue}{k}\right)} \]
    10. Taylor expanded in k around 0

      \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]
    11. Step-by-step derivation
      1. Applied rewrites51.3%

        \[\leadsto \frac{2 \cdot \left(\ell \cdot \ell\right)}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)} \]

      if 1.5499999999999999e-162 < k < 5.5e15

      1. Initial program 61.3%

        \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
      2. Taylor expanded in k around 0

        \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
        2. pow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
        3. lift-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
        5. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
        7. lift-pow.f6465.4

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      4. Applied rewrites65.4%

        \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
        2. unpow3N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
        3. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
        5. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
        6. lower-*.f6465.4

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. Applied rewrites65.4%

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]

      if 5.5e15 < k

      1. Initial program 47.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 rewrites68.5%

        \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
      7. Applied rewrites20.2%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      8. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
        2. metadata-evalN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
        3. pow-prod-upN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
        5. pow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
        6. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
        7. pow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
        8. lift-*.f6420.2

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      9. Applied rewrites20.2%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      10. Taylor expanded in k around inf

        \[\leadsto \left(\frac{-1}{6} \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \cdot 2 \]
      11. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        2. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        3. lower-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        4. pow2N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
        6. pow2N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
        7. lift-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
        8. lift-*.f6457.8

          \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      12. Applied rewrites57.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
    12. Recombined 3 regimes into one program.
    13. Add Preprocessing

    Alternative 23: 57.1% accurate, 10.7× speedup?

    \[\begin{array}{l} k_m = \left|k\right| \\ \begin{array}{l} \mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2\\ \end{array} \end{array} \]
    k_m = (fabs.f64 k)
    (FPCore (t l k_m)
     :precision binary64
     (if (<= k_m 5.5e+15)
       (/ (* l l) (* (* k_m k_m) (* (* t t) t)))
       (* (/ (* -0.16666666666666666 (* l l)) (* (* 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 <= 5.5e+15) {
    		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
    	} else {
    		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * 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 <= 5.5d+15) then
            tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
        else
            tmp = (((-0.16666666666666666d0) * (l * l)) / ((k_m * k_m) * 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 <= 5.5e+15) {
    		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
    	} else {
    		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * t)) * 2.0;
    	}
    	return tmp;
    }
    
    k_m = math.fabs(k)
    def code(t, l, k_m):
    	tmp = 0
    	if k_m <= 5.5e+15:
    		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t))
    	else:
    		tmp = ((-0.16666666666666666 * (l * l)) / ((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 <= 5.5e+15)
    		tmp = Float64(Float64(l * l) / Float64(Float64(k_m * k_m) * Float64(Float64(t * t) * t)));
    	else
    		tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64(l * l)) / Float64(Float64(k_m * k_m) * 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 <= 5.5e+15)
    		tmp = (l * l) / ((k_m * k_m) * ((t * t) * t));
    	else
    		tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * 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, 5.5e+15], N[(N[(l * l), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
    
    \begin{array}{l}
    k_m = \left|k\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;k\_m \leq 5.5 \cdot 10^{+15}:\\
    \;\;\;\;\frac{\ell \cdot \ell}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if k < 5.5e15

      1. Initial program 61.8%

        \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
      2. Taylor expanded in k around 0

        \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{{\ell}^{2}}{\color{blue}{{k}^{2} \cdot {t}^{3}}} \]
        2. pow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
        3. lift-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{{k}^{2}} \cdot {t}^{3}} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{{k}^{2} \cdot \color{blue}{{t}^{3}}} \]
        5. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {\color{blue}{t}}^{3}} \]
        7. lift-pow.f6456.5

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
      4. Applied rewrites56.5%

        \[\leadsto \color{blue}{\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{3}}} \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot {t}^{\color{blue}{3}}} \]
        2. unpow3N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]
        3. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot t\right)} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left({t}^{2} \cdot \color{blue}{t}\right)} \]
        5. unpow2N/A

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
        6. lower-*.f6456.5

          \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)} \]
      6. Applied rewrites56.5%

        \[\leadsto \frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot \color{blue}{t}\right)} \]

      if 5.5e15 < k

      1. Initial program 47.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 rewrites68.5%

        \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
      7. Applied rewrites20.2%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      8. Step-by-step derivation
        1. lift-pow.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
        2. metadata-evalN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
        3. pow-prod-upN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
        5. pow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
        6. lift-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
        7. pow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
        8. lift-*.f6420.2

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      9. Applied rewrites20.2%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      10. Taylor expanded in k around inf

        \[\leadsto \left(\frac{-1}{6} \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \cdot 2 \]
      11. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        2. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        3. lower-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
        4. pow2N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
        6. pow2N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
        7. lift-*.f64N/A

          \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
        8. lift-*.f6457.8

          \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      12. Applied rewrites57.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 24: 32.5% accurate, 12.5× speedup?

    \[\begin{array}{l} k_m = \left|k\right| \\ \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2 \end{array} \]
    k_m = (fabs.f64 k)
    (FPCore (t l k_m)
     :precision binary64
     (* (/ (* -0.16666666666666666 (* l l)) (* (* k_m k_m) t)) 2.0))
    k_m = fabs(k);
    double code(double t, double l, double k_m) {
    	return ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * 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 = (((-0.16666666666666666d0) * (l * l)) / ((k_m * k_m) * t)) * 2.0d0
    end function
    
    k_m = Math.abs(k);
    public static double code(double t, double l, double k_m) {
    	return ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * t)) * 2.0;
    }
    
    k_m = math.fabs(k)
    def code(t, l, k_m):
    	return ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * t)) * 2.0
    
    k_m = abs(k)
    function code(t, l, k_m)
    	return Float64(Float64(Float64(-0.16666666666666666 * Float64(l * l)) / Float64(Float64(k_m * k_m) * t)) * 2.0)
    end
    
    k_m = abs(k);
    function tmp = code(t, l, k_m)
    	tmp = ((-0.16666666666666666 * (l * l)) / ((k_m * k_m) * t)) * 2.0;
    end
    
    k_m = N[Abs[k], $MachinePrecision]
    code[t_, l_, k$95$m_] := N[(N[(N[(-0.16666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
    
    \begin{array}{l}
    k_m = \left|k\right|
    
    \\
    \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k\_m \cdot k\_m\right) \cdot t} \cdot 2
    \end{array}
    
    Derivation
    1. Initial program 55.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. *-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 rewrites60.2%

      \[\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 \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{{k}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{{\ell}^{2}}{t} - \frac{-1}{3} \cdot \frac{{\ell}^{2}}{t}\right) + \frac{{\ell}^{2}}{t}}{{k}^{4}} \cdot 2 \]
    7. Applied rewrites23.0%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
    8. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{4}} \cdot 2 \]
      2. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{\left(2 + 2\right)}} \cdot 2 \]
      3. pow-prod-upN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{{k}^{2} \cdot {k}^{2}} \cdot 2 \]
      5. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot {k}^{2}} \cdot 2 \]
      7. pow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot \frac{-1}{6}, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
      8. lift-*.f6423.0

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    9. Applied rewrites23.0%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666, k \cdot k, \frac{\ell \cdot \ell}{t}\right)}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot 2 \]
    10. Taylor expanded in k around inf

      \[\leadsto \left(\frac{-1}{6} \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot t}\right) \cdot 2 \]
    11. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      2. lower-/.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {\ell}^{2}}{{k}^{2} \cdot t} \cdot 2 \]
      4. pow2N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{{k}^{2} \cdot t} \cdot 2 \]
      6. pow2N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
      8. lift-*.f6432.5

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
    12. Applied rewrites32.5%

      \[\leadsto \frac{-0.16666666666666666 \cdot \left(\ell \cdot \ell\right)}{\left(k \cdot k\right) \cdot t} \cdot 2 \]
    13. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025095 
    (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))))