Toniolo and Linder, Equation (10-)

Percentage Accurate: 35.7% → 97.9%
Time: 12.4s
Alternatives: 16
Speedup: 11.6×

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}

Sampling outcomes in binary64 precision:

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

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

Initial Program: 35.7% 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: 97.9% accurate, 1.3× speedup?

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

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

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

\\
\frac{2}{\left(\frac{k}{\cos k \cdot \ell} \cdot \left(\left(\sin k \cdot t\right) \cdot \frac{k}{\ell}\right)\right) \cdot \sin k}
\end{array}
Derivation
  1. Initial program 34.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. Add Preprocessing
  3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 2: 86.5% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{k}{\ell \cdot \cos k}\\ \mathbf{if}\;k \leq 6 \cdot 10^{-121}:\\ \;\;\;\;\frac{2}{\left(\left(\frac{k \cdot t}{\ell} \cdot k\right) \cdot \sin k\right) \cdot t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left({\sin k}^{2} \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot t\_1}\\ \end{array} \end{array} \]
        (FPCore (t l k)
         :precision binary64
         (let* ((t_1 (/ k (* l (cos k)))))
           (if (<= k 6e-121)
             (/ 2.0 (* (* (* (/ (* k t) l) k) (sin k)) t_1))
             (/ 2.0 (* (* (pow (sin k) 2.0) (* t (/ k l))) t_1)))))
        double code(double t, double l, double k) {
        	double t_1 = k / (l * cos(k));
        	double tmp;
        	if (k <= 6e-121) {
        		tmp = 2.0 / (((((k * t) / l) * k) * sin(k)) * t_1);
        	} else {
        		tmp = 2.0 / ((pow(sin(k), 2.0) * (t * (k / l))) * t_1);
        	}
        	return tmp;
        }
        
        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
            real(8) :: t_1
            real(8) :: tmp
            t_1 = k / (l * cos(k))
            if (k <= 6d-121) then
                tmp = 2.0d0 / (((((k * t) / l) * k) * sin(k)) * t_1)
            else
                tmp = 2.0d0 / (((sin(k) ** 2.0d0) * (t * (k / l))) * t_1)
            end if
            code = tmp
        end function
        
        public static double code(double t, double l, double k) {
        	double t_1 = k / (l * Math.cos(k));
        	double tmp;
        	if (k <= 6e-121) {
        		tmp = 2.0 / (((((k * t) / l) * k) * Math.sin(k)) * t_1);
        	} else {
        		tmp = 2.0 / ((Math.pow(Math.sin(k), 2.0) * (t * (k / l))) * t_1);
        	}
        	return tmp;
        }
        
        def code(t, l, k):
        	t_1 = k / (l * math.cos(k))
        	tmp = 0
        	if k <= 6e-121:
        		tmp = 2.0 / (((((k * t) / l) * k) * math.sin(k)) * t_1)
        	else:
        		tmp = 2.0 / ((math.pow(math.sin(k), 2.0) * (t * (k / l))) * t_1)
        	return tmp
        
        function code(t, l, k)
        	t_1 = Float64(k / Float64(l * cos(k)))
        	tmp = 0.0
        	if (k <= 6e-121)
        		tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k * t) / l) * k) * sin(k)) * t_1));
        	else
        		tmp = Float64(2.0 / Float64(Float64((sin(k) ^ 2.0) * Float64(t * Float64(k / l))) * t_1));
        	end
        	return tmp
        end
        
        function tmp_2 = code(t, l, k)
        	t_1 = k / (l * cos(k));
        	tmp = 0.0;
        	if (k <= 6e-121)
        		tmp = 2.0 / (((((k * t) / l) * k) * sin(k)) * t_1);
        	else
        		tmp = 2.0 / (((sin(k) ^ 2.0) * (t * (k / l))) * t_1);
        	end
        	tmp_2 = tmp;
        end
        
        code[t_, l_, k_] := Block[{t$95$1 = N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 6e-121], N[(2.0 / N[(N[(N[(N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision] * k), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(t * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{k}{\ell \cdot \cos k}\\
        \mathbf{if}\;k \leq 6 \cdot 10^{-121}:\\
        \;\;\;\;\frac{2}{\left(\left(\frac{k \cdot t}{\ell} \cdot k\right) \cdot \sin k\right) \cdot t\_1}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{2}{\left({\sin k}^{2} \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot t\_1}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if k < 5.9999999999999999e-121

          1. Initial program 37.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. Add Preprocessing
          3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 5.9999999999999999e-121 < k

                1. Initial program 30.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. Add Preprocessing
                3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 3: 87.8% accurate, 1.3× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-57}:\\ \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\frac{k}{\cos k \cdot \ell} \cdot \left({\sin k}^{2} \cdot t\right)\right) \cdot \frac{k}{\ell}}\\ \end{array} \end{array} \]
                (FPCore (t l k)
                 :precision binary64
                 (if (<= k 4e-57)
                   (/ 2.0 (* (* (* (* (/ k l) t) (sin k)) (sin k)) (/ k (* l 1.0))))
                   (/ 2.0 (* (* (/ k (* (cos k) l)) (* (pow (sin k) 2.0) t)) (/ k l)))))
                double code(double t, double l, double k) {
                	double tmp;
                	if (k <= 4e-57) {
                		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                	} else {
                		tmp = 2.0 / (((k / (cos(k) * l)) * (pow(sin(k), 2.0) * t)) * (k / l));
                	}
                	return tmp;
                }
                
                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
                    real(8) :: tmp
                    if (k <= 4d-57) then
                        tmp = 2.0d0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0d0)))
                    else
                        tmp = 2.0d0 / (((k / (cos(k) * l)) * ((sin(k) ** 2.0d0) * t)) * (k / l))
                    end if
                    code = tmp
                end function
                
                public static double code(double t, double l, double k) {
                	double tmp;
                	if (k <= 4e-57) {
                		tmp = 2.0 / (((((k / l) * t) * Math.sin(k)) * Math.sin(k)) * (k / (l * 1.0)));
                	} else {
                		tmp = 2.0 / (((k / (Math.cos(k) * l)) * (Math.pow(Math.sin(k), 2.0) * t)) * (k / l));
                	}
                	return tmp;
                }
                
                def code(t, l, k):
                	tmp = 0
                	if k <= 4e-57:
                		tmp = 2.0 / (((((k / l) * t) * math.sin(k)) * math.sin(k)) * (k / (l * 1.0)))
                	else:
                		tmp = 2.0 / (((k / (math.cos(k) * l)) * (math.pow(math.sin(k), 2.0) * t)) * (k / l))
                	return tmp
                
                function code(t, l, k)
                	tmp = 0.0
                	if (k <= 4e-57)
                		tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k / l) * t) * sin(k)) * sin(k)) * Float64(k / Float64(l * 1.0))));
                	else
                		tmp = Float64(2.0 / Float64(Float64(Float64(k / Float64(cos(k) * l)) * Float64((sin(k) ^ 2.0) * t)) * Float64(k / l)));
                	end
                	return tmp
                end
                
                function tmp_2 = code(t, l, k)
                	tmp = 0.0;
                	if (k <= 4e-57)
                		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                	else
                		tmp = 2.0 / (((k / (cos(k) * l)) * ((sin(k) ^ 2.0) * t)) * (k / l));
                	end
                	tmp_2 = tmp;
                end
                
                code[t_, l_, k_] := If[LessEqual[k, 4e-57], N[(2.0 / N[(N[(N[(N[(N[(k / l), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;k \leq 4 \cdot 10^{-57}:\\
                \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{2}{\left(\frac{k}{\cos k \cdot \ell} \cdot \left({\sin k}^{2} \cdot t\right)\right) \cdot \frac{k}{\ell}}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if k < 3.99999999999999982e-57

                  1. Initial program 37.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. Add Preprocessing
                  3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites85.1%

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

                        if 3.99999999999999982e-57 < k

                        1. Initial program 29.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 4: 98.0% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 5: 87.7% accurate, 1.7× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 7.4 \cdot 10^{-5}:\\ \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\ \end{array} \end{array} \]
                            (FPCore (t l k)
                             :precision binary64
                             (if (<= k 7.4e-5)
                               (/ 2.0 (* (* (* (* (/ k l) t) (sin k)) (sin k)) (/ k (* l 1.0))))
                               (/
                                2.0
                                (* (* (- 0.5 (* 0.5 (cos (+ k k)))) (* t (/ k l))) (/ k (* l (cos k)))))))
                            double code(double t, double l, double k) {
                            	double tmp;
                            	if (k <= 7.4e-5) {
                            		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                            	} else {
                            		tmp = 2.0 / (((0.5 - (0.5 * cos((k + k)))) * (t * (k / l))) * (k / (l * cos(k))));
                            	}
                            	return tmp;
                            }
                            
                            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
                                real(8) :: tmp
                                if (k <= 7.4d-5) then
                                    tmp = 2.0d0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0d0)))
                                else
                                    tmp = 2.0d0 / (((0.5d0 - (0.5d0 * cos((k + k)))) * (t * (k / l))) * (k / (l * cos(k))))
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double t, double l, double k) {
                            	double tmp;
                            	if (k <= 7.4e-5) {
                            		tmp = 2.0 / (((((k / l) * t) * Math.sin(k)) * Math.sin(k)) * (k / (l * 1.0)));
                            	} else {
                            		tmp = 2.0 / (((0.5 - (0.5 * Math.cos((k + k)))) * (t * (k / l))) * (k / (l * Math.cos(k))));
                            	}
                            	return tmp;
                            }
                            
                            def code(t, l, k):
                            	tmp = 0
                            	if k <= 7.4e-5:
                            		tmp = 2.0 / (((((k / l) * t) * math.sin(k)) * math.sin(k)) * (k / (l * 1.0)))
                            	else:
                            		tmp = 2.0 / (((0.5 - (0.5 * math.cos((k + k)))) * (t * (k / l))) * (k / (l * math.cos(k))))
                            	return tmp
                            
                            function code(t, l, k)
                            	tmp = 0.0
                            	if (k <= 7.4e-5)
                            		tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k / l) * t) * sin(k)) * sin(k)) * Float64(k / Float64(l * 1.0))));
                            	else
                            		tmp = Float64(2.0 / Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * Float64(t * Float64(k / l))) * Float64(k / Float64(l * cos(k)))));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(t, l, k)
                            	tmp = 0.0;
                            	if (k <= 7.4e-5)
                            		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                            	else
                            		tmp = 2.0 / (((0.5 - (0.5 * cos((k + k)))) * (t * (k / l))) * (k / (l * cos(k))));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[t_, l_, k_] := If[LessEqual[k, 7.4e-5], N[(2.0 / N[(N[(N[(N[(N[(k / l), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;k \leq 7.4 \cdot 10^{-5}:\\
                            \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{2}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if k < 7.39999999999999962e-5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites86.1%

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

                                    if 7.39999999999999962e-5 < k

                                    1. Initial program 30.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. Add Preprocessing
                                    3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      Alternative 6: 86.4% accurate, 1.7× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 5 \cdot 10^{-19}:\\ \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{k}{\ell} \cdot \left(\frac{k \cdot t}{\ell} \cdot \left(\tan k \cdot \sin k\right)\right)}\\ \end{array} \end{array} \]
                                      (FPCore (t l k)
                                       :precision binary64
                                       (if (<= k 5e-19)
                                         (/ 2.0 (* (* (* (* (/ k l) t) (sin k)) (sin k)) (/ k (* l 1.0))))
                                         (/ 2.0 (* (/ k l) (* (/ (* k t) l) (* (tan k) (sin k)))))))
                                      double code(double t, double l, double k) {
                                      	double tmp;
                                      	if (k <= 5e-19) {
                                      		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                                      	} else {
                                      		tmp = 2.0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      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
                                          real(8) :: tmp
                                          if (k <= 5d-19) then
                                              tmp = 2.0d0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0d0)))
                                          else
                                              tmp = 2.0d0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))))
                                          end if
                                          code = tmp
                                      end function
                                      
                                      public static double code(double t, double l, double k) {
                                      	double tmp;
                                      	if (k <= 5e-19) {
                                      		tmp = 2.0 / (((((k / l) * t) * Math.sin(k)) * Math.sin(k)) * (k / (l * 1.0)));
                                      	} else {
                                      		tmp = 2.0 / ((k / l) * (((k * t) / l) * (Math.tan(k) * Math.sin(k))));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      def code(t, l, k):
                                      	tmp = 0
                                      	if k <= 5e-19:
                                      		tmp = 2.0 / (((((k / l) * t) * math.sin(k)) * math.sin(k)) * (k / (l * 1.0)))
                                      	else:
                                      		tmp = 2.0 / ((k / l) * (((k * t) / l) * (math.tan(k) * math.sin(k))))
                                      	return tmp
                                      
                                      function code(t, l, k)
                                      	tmp = 0.0
                                      	if (k <= 5e-19)
                                      		tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k / l) * t) * sin(k)) * sin(k)) * Float64(k / Float64(l * 1.0))));
                                      	else
                                      		tmp = Float64(2.0 / Float64(Float64(k / l) * Float64(Float64(Float64(k * t) / l) * Float64(tan(k) * sin(k)))));
                                      	end
                                      	return tmp
                                      end
                                      
                                      function tmp_2 = code(t, l, k)
                                      	tmp = 0.0;
                                      	if (k <= 5e-19)
                                      		tmp = 2.0 / (((((k / l) * t) * sin(k)) * sin(k)) * (k / (l * 1.0)));
                                      	else
                                      		tmp = 2.0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))));
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      code[t_, l_, k_] := If[LessEqual[k, 5e-19], N[(2.0 / N[(N[(N[(N[(N[(k / l), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(k / l), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;k \leq 5 \cdot 10^{-19}:\\
                                      \;\;\;\;\frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{2}{\frac{k}{\ell} \cdot \left(\frac{k \cdot t}{\ell} \cdot \left(\tan k \cdot \sin k\right)\right)}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if k < 5.0000000000000004e-19

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              \[\leadsto \frac{2}{\left(\left(\left(\frac{k}{\ell} \cdot t\right) \cdot \sin k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot 1}} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites85.9%

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

                                              if 5.0000000000000004e-19 < k

                                              1. Initial program 29.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. Add Preprocessing
                                              3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              Alternative 7: 85.0% accurate, 1.7× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{k \cdot t}{\ell}\\ \mathbf{if}\;k \leq 5.6 \cdot 10^{-121}:\\ \;\;\;\;\frac{2}{\left(\left(t\_1 \cdot k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot \cos k}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{k}{\ell} \cdot \left(t\_1 \cdot \left(\tan k \cdot \sin k\right)\right)}\\ \end{array} \end{array} \]
                                              (FPCore (t l k)
                                               :precision binary64
                                               (let* ((t_1 (/ (* k t) l)))
                                                 (if (<= k 5.6e-121)
                                                   (/ 2.0 (* (* (* t_1 k) (sin k)) (/ k (* l (cos k)))))
                                                   (/ 2.0 (* (/ k l) (* t_1 (* (tan k) (sin k))))))))
                                              double code(double t, double l, double k) {
                                              	double t_1 = (k * t) / l;
                                              	double tmp;
                                              	if (k <= 5.6e-121) {
                                              		tmp = 2.0 / (((t_1 * k) * sin(k)) * (k / (l * cos(k))));
                                              	} else {
                                              		tmp = 2.0 / ((k / l) * (t_1 * (tan(k) * sin(k))));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              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
                                                  real(8) :: t_1
                                                  real(8) :: tmp
                                                  t_1 = (k * t) / l
                                                  if (k <= 5.6d-121) then
                                                      tmp = 2.0d0 / (((t_1 * k) * sin(k)) * (k / (l * cos(k))))
                                                  else
                                                      tmp = 2.0d0 / ((k / l) * (t_1 * (tan(k) * sin(k))))
                                                  end if
                                                  code = tmp
                                              end function
                                              
                                              public static double code(double t, double l, double k) {
                                              	double t_1 = (k * t) / l;
                                              	double tmp;
                                              	if (k <= 5.6e-121) {
                                              		tmp = 2.0 / (((t_1 * k) * Math.sin(k)) * (k / (l * Math.cos(k))));
                                              	} else {
                                              		tmp = 2.0 / ((k / l) * (t_1 * (Math.tan(k) * Math.sin(k))));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              def code(t, l, k):
                                              	t_1 = (k * t) / l
                                              	tmp = 0
                                              	if k <= 5.6e-121:
                                              		tmp = 2.0 / (((t_1 * k) * math.sin(k)) * (k / (l * math.cos(k))))
                                              	else:
                                              		tmp = 2.0 / ((k / l) * (t_1 * (math.tan(k) * math.sin(k))))
                                              	return tmp
                                              
                                              function code(t, l, k)
                                              	t_1 = Float64(Float64(k * t) / l)
                                              	tmp = 0.0
                                              	if (k <= 5.6e-121)
                                              		tmp = Float64(2.0 / Float64(Float64(Float64(t_1 * k) * sin(k)) * Float64(k / Float64(l * cos(k)))));
                                              	else
                                              		tmp = Float64(2.0 / Float64(Float64(k / l) * Float64(t_1 * Float64(tan(k) * sin(k)))));
                                              	end
                                              	return tmp
                                              end
                                              
                                              function tmp_2 = code(t, l, k)
                                              	t_1 = (k * t) / l;
                                              	tmp = 0.0;
                                              	if (k <= 5.6e-121)
                                              		tmp = 2.0 / (((t_1 * k) * sin(k)) * (k / (l * cos(k))));
                                              	else
                                              		tmp = 2.0 / ((k / l) * (t_1 * (tan(k) * sin(k))));
                                              	end
                                              	tmp_2 = tmp;
                                              end
                                              
                                              code[t_, l_, k_] := Block[{t$95$1 = N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[k, 5.6e-121], N[(2.0 / N[(N[(N[(t$95$1 * k), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(k / l), $MachinePrecision] * N[(t$95$1 * N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              t_1 := \frac{k \cdot t}{\ell}\\
                                              \mathbf{if}\;k \leq 5.6 \cdot 10^{-121}:\\
                                              \;\;\;\;\frac{2}{\left(\left(t\_1 \cdot k\right) \cdot \sin k\right) \cdot \frac{k}{\ell \cdot \cos k}}\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\frac{2}{\frac{k}{\ell} \cdot \left(t\_1 \cdot \left(\tan k \cdot \sin k\right)\right)}\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if k < 5.6000000000000002e-121

                                                1. Initial program 37.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. Add Preprocessing
                                                3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      if 5.6000000000000002e-121 < k

                                                      1. Initial program 30.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. Add Preprocessing
                                                      3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      Alternative 8: 84.0% accurate, 1.8× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 2 \cdot 10^{-291}:\\ \;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\tan k \cdot \sin k\right) \cdot \frac{\left(k \cdot t\right) \cdot k}{\ell \cdot \ell}}\\ \end{array} \end{array} \]
                                                      (FPCore (t l k)
                                                       :precision binary64
                                                       (if (<= (* l l) 2e-291)
                                                         (/ 2.0 (* (* (* k k) (* t (/ k l))) (/ k (* l (cos k)))))
                                                         (/ 2.0 (* (* (tan k) (sin k)) (/ (* (* k t) k) (* l l))))))
                                                      double code(double t, double l, double k) {
                                                      	double tmp;
                                                      	if ((l * l) <= 2e-291) {
                                                      		tmp = 2.0 / (((k * k) * (t * (k / l))) * (k / (l * cos(k))));
                                                      	} else {
                                                      		tmp = 2.0 / ((tan(k) * sin(k)) * (((k * t) * k) / (l * l)));
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      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
                                                          real(8) :: tmp
                                                          if ((l * l) <= 2d-291) then
                                                              tmp = 2.0d0 / (((k * k) * (t * (k / l))) * (k / (l * cos(k))))
                                                          else
                                                              tmp = 2.0d0 / ((tan(k) * sin(k)) * (((k * t) * k) / (l * l)))
                                                          end if
                                                          code = tmp
                                                      end function
                                                      
                                                      public static double code(double t, double l, double k) {
                                                      	double tmp;
                                                      	if ((l * l) <= 2e-291) {
                                                      		tmp = 2.0 / (((k * k) * (t * (k / l))) * (k / (l * Math.cos(k))));
                                                      	} else {
                                                      		tmp = 2.0 / ((Math.tan(k) * Math.sin(k)) * (((k * t) * k) / (l * l)));
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      def code(t, l, k):
                                                      	tmp = 0
                                                      	if (l * l) <= 2e-291:
                                                      		tmp = 2.0 / (((k * k) * (t * (k / l))) * (k / (l * math.cos(k))))
                                                      	else:
                                                      		tmp = 2.0 / ((math.tan(k) * math.sin(k)) * (((k * t) * k) / (l * l)))
                                                      	return tmp
                                                      
                                                      function code(t, l, k)
                                                      	tmp = 0.0
                                                      	if (Float64(l * l) <= 2e-291)
                                                      		tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * Float64(t * Float64(k / l))) * Float64(k / Float64(l * cos(k)))));
                                                      	else
                                                      		tmp = Float64(2.0 / Float64(Float64(tan(k) * sin(k)) * Float64(Float64(Float64(k * t) * k) / Float64(l * l))));
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      function tmp_2 = code(t, l, k)
                                                      	tmp = 0.0;
                                                      	if ((l * l) <= 2e-291)
                                                      		tmp = 2.0 / (((k * k) * (t * (k / l))) * (k / (l * cos(k))));
                                                      	else
                                                      		tmp = 2.0 / ((tan(k) * sin(k)) * (((k * t) * k) / (l * l)));
                                                      	end
                                                      	tmp_2 = tmp;
                                                      end
                                                      
                                                      code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 2e-291], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * N[(t * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      \mathbf{if}\;\ell \cdot \ell \leq 2 \cdot 10^{-291}:\\
                                                      \;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;\frac{2}{\left(\tan k \cdot \sin k\right) \cdot \frac{\left(k \cdot t\right) \cdot k}{\ell \cdot \ell}}\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if (*.f64 l l) < 1.99999999999999992e-291

                                                        1. Initial program 11.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. Add Preprocessing
                                                        3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            if 1.99999999999999992e-291 < (*.f64 l l)

                                                            1. Initial program 41.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. Add Preprocessing
                                                            3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            Alternative 9: 93.6% accurate, 1.8× speedup?

                                                            \[\begin{array}{l} \\ \frac{2}{\frac{k}{\ell} \cdot \left(\frac{k \cdot t}{\ell} \cdot \left(\tan k \cdot \sin k\right)\right)} \end{array} \]
                                                            (FPCore (t l k)
                                                             :precision binary64
                                                             (/ 2.0 (* (/ k l) (* (/ (* k t) l) (* (tan k) (sin k))))))
                                                            double code(double t, double l, double k) {
                                                            	return 2.0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))));
                                                            }
                                                            
                                                            module fmin_fmax_functions
                                                                implicit none
                                                                private
                                                                public fmax
                                                                public fmin
                                                            
                                                                interface fmax
                                                                    module procedure fmax88
                                                                    module procedure fmax44
                                                                    module procedure fmax84
                                                                    module procedure fmax48
                                                                end interface
                                                                interface fmin
                                                                    module procedure fmin88
                                                                    module procedure fmin44
                                                                    module procedure fmin84
                                                                    module procedure fmin48
                                                                end interface
                                                            contains
                                                                real(8) function fmax88(x, y) result (res)
                                                                    real(8), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                end function
                                                                real(4) function fmax44(x, y) result (res)
                                                                    real(4), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmax84(x, y) result(res)
                                                                    real(8), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmax48(x, y) result(res)
                                                                    real(4), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin88(x, y) result (res)
                                                                    real(8), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                end function
                                                                real(4) function fmin44(x, y) result (res)
                                                                    real(4), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin84(x, y) result(res)
                                                                    real(8), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin48(x, y) result(res)
                                                                    real(4), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                end function
                                                            end module
                                                            
                                                            real(8) function code(t, l, k)
                                                            use fmin_fmax_functions
                                                                real(8), intent (in) :: t
                                                                real(8), intent (in) :: l
                                                                real(8), intent (in) :: k
                                                                code = 2.0d0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))))
                                                            end function
                                                            
                                                            public static double code(double t, double l, double k) {
                                                            	return 2.0 / ((k / l) * (((k * t) / l) * (Math.tan(k) * Math.sin(k))));
                                                            }
                                                            
                                                            def code(t, l, k):
                                                            	return 2.0 / ((k / l) * (((k * t) / l) * (math.tan(k) * math.sin(k))))
                                                            
                                                            function code(t, l, k)
                                                            	return Float64(2.0 / Float64(Float64(k / l) * Float64(Float64(Float64(k * t) / l) * Float64(tan(k) * sin(k)))))
                                                            end
                                                            
                                                            function tmp = code(t, l, k)
                                                            	tmp = 2.0 / ((k / l) * (((k * t) / l) * (tan(k) * sin(k))));
                                                            end
                                                            
                                                            code[t_, l_, k_] := N[(2.0 / N[(N[(k / l), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \frac{2}{\frac{k}{\ell} \cdot \left(\frac{k \cdot t}{\ell} \cdot \left(\tan k \cdot \sin k\right)\right)}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Initial program 34.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. Add Preprocessing
                                                            3. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                              Alternative 10: 74.9% accurate, 2.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  \[\leadsto \frac{2}{\left({k}^{2} \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites74.9%

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

                                                                  Alternative 11: 74.0% accurate, 8.6× speedup?

                                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 25500000:\\ \;\;\;\;\frac{\ell \cdot 2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\ell}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\ \end{array} \end{array} \]
                                                                  (FPCore (t l k)
                                                                   :precision binary64
                                                                   (if (<= k 25500000.0)
                                                                     (* (/ (* l 2.0) (* t (* k k))) (/ l (* k k)))
                                                                     (* (/ -0.3333333333333333 t) (* (/ l k) (/ l k)))))
                                                                  double code(double t, double l, double k) {
                                                                  	double tmp;
                                                                  	if (k <= 25500000.0) {
                                                                  		tmp = ((l * 2.0) / (t * (k * k))) * (l / (k * k));
                                                                  	} else {
                                                                  		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  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
                                                                      real(8) :: tmp
                                                                      if (k <= 25500000.0d0) then
                                                                          tmp = ((l * 2.0d0) / (t * (k * k))) * (l / (k * k))
                                                                      else
                                                                          tmp = ((-0.3333333333333333d0) / t) * ((l / k) * (l / k))
                                                                      end if
                                                                      code = tmp
                                                                  end function
                                                                  
                                                                  public static double code(double t, double l, double k) {
                                                                  	double tmp;
                                                                  	if (k <= 25500000.0) {
                                                                  		tmp = ((l * 2.0) / (t * (k * k))) * (l / (k * k));
                                                                  	} else {
                                                                  		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  def code(t, l, k):
                                                                  	tmp = 0
                                                                  	if k <= 25500000.0:
                                                                  		tmp = ((l * 2.0) / (t * (k * k))) * (l / (k * k))
                                                                  	else:
                                                                  		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k))
                                                                  	return tmp
                                                                  
                                                                  function code(t, l, k)
                                                                  	tmp = 0.0
                                                                  	if (k <= 25500000.0)
                                                                  		tmp = Float64(Float64(Float64(l * 2.0) / Float64(t * Float64(k * k))) * Float64(l / Float64(k * k)));
                                                                  	else
                                                                  		tmp = Float64(Float64(-0.3333333333333333 / t) * Float64(Float64(l / k) * Float64(l / k)));
                                                                  	end
                                                                  	return tmp
                                                                  end
                                                                  
                                                                  function tmp_2 = code(t, l, k)
                                                                  	tmp = 0.0;
                                                                  	if (k <= 25500000.0)
                                                                  		tmp = ((l * 2.0) / (t * (k * k))) * (l / (k * k));
                                                                  	else
                                                                  		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                  	end
                                                                  	tmp_2 = tmp;
                                                                  end
                                                                  
                                                                  code[t_, l_, k_] := If[LessEqual[k, 25500000.0], N[(N[(N[(l * 2.0), $MachinePrecision] / N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / t), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \begin{array}{l}
                                                                  \mathbf{if}\;k \leq 25500000:\\
                                                                  \;\;\;\;\frac{\ell \cdot 2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\ell}{k \cdot k}\\
                                                                  
                                                                  \mathbf{else}:\\
                                                                  \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\
                                                                  
                                                                  
                                                                  \end{array}
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Split input into 2 regimes
                                                                  2. if k < 2.55e7

                                                                    1. Initial program 36.4%

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

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

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

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

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

                                                                        \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                      5. div-addN/A

                                                                        \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                      6. associate-/r*N/A

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

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

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

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

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

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

                                                                        \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                      13. associate-/l*N/A

                                                                        \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                      14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

                                                                      if 2.55e7 < k

                                                                      1. Initial program 29.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \frac{{k}^{2} \cdot {\ell}^{2}}{t} + 2 \cdot \frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                      7. Applied rewrites17.0%

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

                                                                        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
                                                                      9. Step-by-step derivation
                                                                        1. Applied rewrites54.8%

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

                                                                      Alternative 12: 73.6% accurate, 8.9× speedup?

                                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 25500000:\\ \;\;\;\;\frac{\frac{\ell}{\left(k \cdot k\right) \cdot t}}{k \cdot k} \cdot \left(\ell + \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\ \end{array} \end{array} \]
                                                                      (FPCore (t l k)
                                                                       :precision binary64
                                                                       (if (<= k 25500000.0)
                                                                         (* (/ (/ l (* (* k k) t)) (* k k)) (+ l l))
                                                                         (* (/ -0.3333333333333333 t) (* (/ l k) (/ l k)))))
                                                                      double code(double t, double l, double k) {
                                                                      	double tmp;
                                                                      	if (k <= 25500000.0) {
                                                                      		tmp = ((l / ((k * k) * t)) / (k * k)) * (l + l);
                                                                      	} else {
                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      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
                                                                          real(8) :: tmp
                                                                          if (k <= 25500000.0d0) then
                                                                              tmp = ((l / ((k * k) * t)) / (k * k)) * (l + l)
                                                                          else
                                                                              tmp = ((-0.3333333333333333d0) / t) * ((l / k) * (l / k))
                                                                          end if
                                                                          code = tmp
                                                                      end function
                                                                      
                                                                      public static double code(double t, double l, double k) {
                                                                      	double tmp;
                                                                      	if (k <= 25500000.0) {
                                                                      		tmp = ((l / ((k * k) * t)) / (k * k)) * (l + l);
                                                                      	} else {
                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      def code(t, l, k):
                                                                      	tmp = 0
                                                                      	if k <= 25500000.0:
                                                                      		tmp = ((l / ((k * k) * t)) / (k * k)) * (l + l)
                                                                      	else:
                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k))
                                                                      	return tmp
                                                                      
                                                                      function code(t, l, k)
                                                                      	tmp = 0.0
                                                                      	if (k <= 25500000.0)
                                                                      		tmp = Float64(Float64(Float64(l / Float64(Float64(k * k) * t)) / Float64(k * k)) * Float64(l + l));
                                                                      	else
                                                                      		tmp = Float64(Float64(-0.3333333333333333 / t) * Float64(Float64(l / k) * Float64(l / k)));
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      function tmp_2 = code(t, l, k)
                                                                      	tmp = 0.0;
                                                                      	if (k <= 25500000.0)
                                                                      		tmp = ((l / ((k * k) * t)) / (k * k)) * (l + l);
                                                                      	else
                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                      	end
                                                                      	tmp_2 = tmp;
                                                                      end
                                                                      
                                                                      code[t_, l_, k_] := If[LessEqual[k, 25500000.0], N[(N[(N[(l / N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / t), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \begin{array}{l}
                                                                      \mathbf{if}\;k \leq 25500000:\\
                                                                      \;\;\;\;\frac{\frac{\ell}{\left(k \cdot k\right) \cdot t}}{k \cdot k} \cdot \left(\ell + \ell\right)\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\
                                                                      
                                                                      
                                                                      \end{array}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Split input into 2 regimes
                                                                      2. if k < 2.55e7

                                                                        1. Initial program 36.4%

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

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

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

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

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

                                                                            \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                          5. div-addN/A

                                                                            \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                          6. associate-/r*N/A

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

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

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

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

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

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

                                                                            \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                          13. associate-/l*N/A

                                                                            \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                          14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

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

                                                                              if 2.55e7 < k

                                                                              1. Initial program 29.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \frac{{k}^{2} \cdot {\ell}^{2}}{t} + 2 \cdot \frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                              7. Applied rewrites17.0%

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

                                                                                \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
                                                                              9. Step-by-step derivation
                                                                                1. Applied rewrites54.8%

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

                                                                              Alternative 13: 73.6% accurate, 8.9× speedup?

                                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 25500000:\\ \;\;\;\;\frac{\frac{\ell}{k \cdot k}}{\left(k \cdot k\right) \cdot t} \cdot \left(\ell + \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\ \end{array} \end{array} \]
                                                                              (FPCore (t l k)
                                                                               :precision binary64
                                                                               (if (<= k 25500000.0)
                                                                                 (* (/ (/ l (* k k)) (* (* k k) t)) (+ l l))
                                                                                 (* (/ -0.3333333333333333 t) (* (/ l k) (/ l k)))))
                                                                              double code(double t, double l, double k) {
                                                                              	double tmp;
                                                                              	if (k <= 25500000.0) {
                                                                              		tmp = ((l / (k * k)) / ((k * k) * t)) * (l + l);
                                                                              	} else {
                                                                              		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                              	}
                                                                              	return tmp;
                                                                              }
                                                                              
                                                                              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
                                                                                  real(8) :: tmp
                                                                                  if (k <= 25500000.0d0) then
                                                                                      tmp = ((l / (k * k)) / ((k * k) * t)) * (l + l)
                                                                                  else
                                                                                      tmp = ((-0.3333333333333333d0) / t) * ((l / k) * (l / k))
                                                                                  end if
                                                                                  code = tmp
                                                                              end function
                                                                              
                                                                              public static double code(double t, double l, double k) {
                                                                              	double tmp;
                                                                              	if (k <= 25500000.0) {
                                                                              		tmp = ((l / (k * k)) / ((k * k) * t)) * (l + l);
                                                                              	} else {
                                                                              		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                              	}
                                                                              	return tmp;
                                                                              }
                                                                              
                                                                              def code(t, l, k):
                                                                              	tmp = 0
                                                                              	if k <= 25500000.0:
                                                                              		tmp = ((l / (k * k)) / ((k * k) * t)) * (l + l)
                                                                              	else:
                                                                              		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k))
                                                                              	return tmp
                                                                              
                                                                              function code(t, l, k)
                                                                              	tmp = 0.0
                                                                              	if (k <= 25500000.0)
                                                                              		tmp = Float64(Float64(Float64(l / Float64(k * k)) / Float64(Float64(k * k) * t)) * Float64(l + l));
                                                                              	else
                                                                              		tmp = Float64(Float64(-0.3333333333333333 / t) * Float64(Float64(l / k) * Float64(l / k)));
                                                                              	end
                                                                              	return tmp
                                                                              end
                                                                              
                                                                              function tmp_2 = code(t, l, k)
                                                                              	tmp = 0.0;
                                                                              	if (k <= 25500000.0)
                                                                              		tmp = ((l / (k * k)) / ((k * k) * t)) * (l + l);
                                                                              	else
                                                                              		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                              	end
                                                                              	tmp_2 = tmp;
                                                                              end
                                                                              
                                                                              code[t_, l_, k_] := If[LessEqual[k, 25500000.0], N[(N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / t), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                              
                                                                              \begin{array}{l}
                                                                              
                                                                              \\
                                                                              \begin{array}{l}
                                                                              \mathbf{if}\;k \leq 25500000:\\
                                                                              \;\;\;\;\frac{\frac{\ell}{k \cdot k}}{\left(k \cdot k\right) \cdot t} \cdot \left(\ell + \ell\right)\\
                                                                              
                                                                              \mathbf{else}:\\
                                                                              \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\
                                                                              
                                                                              
                                                                              \end{array}
                                                                              \end{array}
                                                                              
                                                                              Derivation
                                                                              1. Split input into 2 regimes
                                                                              2. if k < 2.55e7

                                                                                1. Initial program 36.4%

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

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

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

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

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

                                                                                    \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                                  5. div-addN/A

                                                                                    \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                  6. associate-/r*N/A

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

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

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

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

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

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

                                                                                    \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                                  13. associate-/l*N/A

                                                                                    \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                                  14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

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

                                                                                      if 2.55e7 < k

                                                                                      1. Initial program 29.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \frac{{k}^{2} \cdot {\ell}^{2}}{t} + 2 \cdot \frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                      7. Applied rewrites17.0%

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

                                                                                        \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
                                                                                      9. Step-by-step derivation
                                                                                        1. Applied rewrites54.8%

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

                                                                                      Alternative 14: 71.8% accurate, 9.2× speedup?

                                                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 25500000:\\ \;\;\;\;\frac{\ell}{\left(\left(k \cdot t\right) \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\ \end{array} \end{array} \]
                                                                                      (FPCore (t l k)
                                                                                       :precision binary64
                                                                                       (if (<= k 25500000.0)
                                                                                         (* (/ l (* (* (* k t) k) (* k k))) (+ l l))
                                                                                         (* (/ -0.3333333333333333 t) (* (/ l k) (/ l k)))))
                                                                                      double code(double t, double l, double k) {
                                                                                      	double tmp;
                                                                                      	if (k <= 25500000.0) {
                                                                                      		tmp = (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                      	} else {
                                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      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
                                                                                          real(8) :: tmp
                                                                                          if (k <= 25500000.0d0) then
                                                                                              tmp = (l / (((k * t) * k) * (k * k))) * (l + l)
                                                                                          else
                                                                                              tmp = ((-0.3333333333333333d0) / t) * ((l / k) * (l / k))
                                                                                          end if
                                                                                          code = tmp
                                                                                      end function
                                                                                      
                                                                                      public static double code(double t, double l, double k) {
                                                                                      	double tmp;
                                                                                      	if (k <= 25500000.0) {
                                                                                      		tmp = (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                      	} else {
                                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      def code(t, l, k):
                                                                                      	tmp = 0
                                                                                      	if k <= 25500000.0:
                                                                                      		tmp = (l / (((k * t) * k) * (k * k))) * (l + l)
                                                                                      	else:
                                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k))
                                                                                      	return tmp
                                                                                      
                                                                                      function code(t, l, k)
                                                                                      	tmp = 0.0
                                                                                      	if (k <= 25500000.0)
                                                                                      		tmp = Float64(Float64(l / Float64(Float64(Float64(k * t) * k) * Float64(k * k))) * Float64(l + l));
                                                                                      	else
                                                                                      		tmp = Float64(Float64(-0.3333333333333333 / t) * Float64(Float64(l / k) * Float64(l / k)));
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      function tmp_2 = code(t, l, k)
                                                                                      	tmp = 0.0;
                                                                                      	if (k <= 25500000.0)
                                                                                      		tmp = (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                      	else
                                                                                      		tmp = (-0.3333333333333333 / t) * ((l / k) * (l / k));
                                                                                      	end
                                                                                      	tmp_2 = tmp;
                                                                                      end
                                                                                      
                                                                                      code[t_, l_, k_] := If[LessEqual[k, 25500000.0], N[(N[(l / N[(N[(N[(k * t), $MachinePrecision] * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / t), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      
                                                                                      \\
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;k \leq 25500000:\\
                                                                                      \;\;\;\;\frac{\ell}{\left(\left(k \cdot t\right) \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right)\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;\frac{-0.3333333333333333}{t} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if k < 2.55e7

                                                                                        1. Initial program 36.4%

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

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

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

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

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

                                                                                            \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                                          5. div-addN/A

                                                                                            \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                          6. associate-/r*N/A

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

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

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

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

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

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

                                                                                            \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                                          13. associate-/l*N/A

                                                                                            \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                                          14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

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

                                                                                              if 2.55e7 < k

                                                                                              1. Initial program 29.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot \frac{{k}^{2} \cdot {\ell}^{2}}{t} + 2 \cdot \frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                              7. Applied rewrites17.0%

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

                                                                                                \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{{\ell}^{2}}{{k}^{2} \cdot t}} \]
                                                                                              9. Step-by-step derivation
                                                                                                1. Applied rewrites54.8%

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

                                                                                              Alternative 15: 70.8% accurate, 11.6× speedup?

                                                                                              \[\begin{array}{l} \\ \frac{\ell}{\left(\left(k \cdot t\right) \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right) \end{array} \]
                                                                                              (FPCore (t l k)
                                                                                               :precision binary64
                                                                                               (* (/ l (* (* (* k t) k) (* k k))) (+ l l)))
                                                                                              double code(double t, double l, double k) {
                                                                                              	return (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                              }
                                                                                              
                                                                                              module fmin_fmax_functions
                                                                                                  implicit none
                                                                                                  private
                                                                                                  public fmax
                                                                                                  public fmin
                                                                                              
                                                                                                  interface fmax
                                                                                                      module procedure fmax88
                                                                                                      module procedure fmax44
                                                                                                      module procedure fmax84
                                                                                                      module procedure fmax48
                                                                                                  end interface
                                                                                                  interface fmin
                                                                                                      module procedure fmin88
                                                                                                      module procedure fmin44
                                                                                                      module procedure fmin84
                                                                                                      module procedure fmin48
                                                                                                  end interface
                                                                                              contains
                                                                                                  real(8) function fmax88(x, y) result (res)
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(4) function fmax44(x, y) result (res)
                                                                                                      real(4), intent (in) :: x
                                                                                                      real(4), intent (in) :: y
                                                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(8) function fmax84(x, y) result(res)
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(4), intent (in) :: y
                                                                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(8) function fmax48(x, y) result(res)
                                                                                                      real(4), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(8) function fmin88(x, y) result (res)
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(4) function fmin44(x, y) result (res)
                                                                                                      real(4), intent (in) :: x
                                                                                                      real(4), intent (in) :: y
                                                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(8) function fmin84(x, y) result(res)
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(4), intent (in) :: y
                                                                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                  end function
                                                                                                  real(8) function fmin48(x, y) result(res)
                                                                                                      real(4), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                  end function
                                                                                              end module
                                                                                              
                                                                                              real(8) function code(t, l, k)
                                                                                              use fmin_fmax_functions
                                                                                                  real(8), intent (in) :: t
                                                                                                  real(8), intent (in) :: l
                                                                                                  real(8), intent (in) :: k
                                                                                                  code = (l / (((k * t) * k) * (k * k))) * (l + l)
                                                                                              end function
                                                                                              
                                                                                              public static double code(double t, double l, double k) {
                                                                                              	return (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                              }
                                                                                              
                                                                                              def code(t, l, k):
                                                                                              	return (l / (((k * t) * k) * (k * k))) * (l + l)
                                                                                              
                                                                                              function code(t, l, k)
                                                                                              	return Float64(Float64(l / Float64(Float64(Float64(k * t) * k) * Float64(k * k))) * Float64(l + l))
                                                                                              end
                                                                                              
                                                                                              function tmp = code(t, l, k)
                                                                                              	tmp = (l / (((k * t) * k) * (k * k))) * (l + l);
                                                                                              end
                                                                                              
                                                                                              code[t_, l_, k_] := N[(N[(l / N[(N[(N[(k * t), $MachinePrecision] * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision]
                                                                                              
                                                                                              \begin{array}{l}
                                                                                              
                                                                                              \\
                                                                                              \frac{\ell}{\left(\left(k \cdot t\right) \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right)
                                                                                              \end{array}
                                                                                              
                                                                                              Derivation
                                                                                              1. Initial program 34.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. Add Preprocessing
                                                                                              3. Taylor expanded in k around 0

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

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

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

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

                                                                                                  \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                                                5. div-addN/A

                                                                                                  \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                                6. associate-/r*N/A

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

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

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

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

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

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

                                                                                                  \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                                                13. associate-/l*N/A

                                                                                                  \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                                                14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

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

                                                                                                    Alternative 16: 70.7% accurate, 11.6× speedup?

                                                                                                    \[\begin{array}{l} \\ \frac{\ell}{\left(t \cdot \left(k \cdot k\right)\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right) \end{array} \]
                                                                                                    (FPCore (t l k)
                                                                                                     :precision binary64
                                                                                                     (* (/ l (* (* t (* k k)) (* k k))) (+ l l)))
                                                                                                    double code(double t, double l, double k) {
                                                                                                    	return (l / ((t * (k * k)) * (k * k))) * (l + l);
                                                                                                    }
                                                                                                    
                                                                                                    module fmin_fmax_functions
                                                                                                        implicit none
                                                                                                        private
                                                                                                        public fmax
                                                                                                        public fmin
                                                                                                    
                                                                                                        interface fmax
                                                                                                            module procedure fmax88
                                                                                                            module procedure fmax44
                                                                                                            module procedure fmax84
                                                                                                            module procedure fmax48
                                                                                                        end interface
                                                                                                        interface fmin
                                                                                                            module procedure fmin88
                                                                                                            module procedure fmin44
                                                                                                            module procedure fmin84
                                                                                                            module procedure fmin48
                                                                                                        end interface
                                                                                                    contains
                                                                                                        real(8) function fmax88(x, y) result (res)
                                                                                                            real(8), intent (in) :: x
                                                                                                            real(8), intent (in) :: y
                                                                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(4) function fmax44(x, y) result (res)
                                                                                                            real(4), intent (in) :: x
                                                                                                            real(4), intent (in) :: y
                                                                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(8) function fmax84(x, y) result(res)
                                                                                                            real(8), intent (in) :: x
                                                                                                            real(4), intent (in) :: y
                                                                                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(8) function fmax48(x, y) result(res)
                                                                                                            real(4), intent (in) :: x
                                                                                                            real(8), intent (in) :: y
                                                                                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(8) function fmin88(x, y) result (res)
                                                                                                            real(8), intent (in) :: x
                                                                                                            real(8), intent (in) :: y
                                                                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(4) function fmin44(x, y) result (res)
                                                                                                            real(4), intent (in) :: x
                                                                                                            real(4), intent (in) :: y
                                                                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(8) function fmin84(x, y) result(res)
                                                                                                            real(8), intent (in) :: x
                                                                                                            real(4), intent (in) :: y
                                                                                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                        end function
                                                                                                        real(8) function fmin48(x, y) result(res)
                                                                                                            real(4), intent (in) :: x
                                                                                                            real(8), intent (in) :: y
                                                                                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                        end function
                                                                                                    end module
                                                                                                    
                                                                                                    real(8) function code(t, l, k)
                                                                                                    use fmin_fmax_functions
                                                                                                        real(8), intent (in) :: t
                                                                                                        real(8), intent (in) :: l
                                                                                                        real(8), intent (in) :: k
                                                                                                        code = (l / ((t * (k * k)) * (k * k))) * (l + l)
                                                                                                    end function
                                                                                                    
                                                                                                    public static double code(double t, double l, double k) {
                                                                                                    	return (l / ((t * (k * k)) * (k * k))) * (l + l);
                                                                                                    }
                                                                                                    
                                                                                                    def code(t, l, k):
                                                                                                    	return (l / ((t * (k * k)) * (k * k))) * (l + l)
                                                                                                    
                                                                                                    function code(t, l, k)
                                                                                                    	return Float64(Float64(l / Float64(Float64(t * Float64(k * k)) * Float64(k * k))) * Float64(l + l))
                                                                                                    end
                                                                                                    
                                                                                                    function tmp = code(t, l, k)
                                                                                                    	tmp = (l / ((t * (k * k)) * (k * k))) * (l + l);
                                                                                                    end
                                                                                                    
                                                                                                    code[t_, l_, k_] := N[(N[(l / N[(N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision]
                                                                                                    
                                                                                                    \begin{array}{l}
                                                                                                    
                                                                                                    \\
                                                                                                    \frac{\ell}{\left(t \cdot \left(k \cdot k\right)\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell + \ell\right)
                                                                                                    \end{array}
                                                                                                    
                                                                                                    Derivation
                                                                                                    1. Initial program 34.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. Add Preprocessing
                                                                                                    3. Taylor expanded in k around 0

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

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

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

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

                                                                                                        \[\leadsto \frac{\color{blue}{\frac{{\ell}^{2}}{t} + \frac{{\ell}^{2}}{t}}}{{k}^{4}} \]
                                                                                                      5. div-addN/A

                                                                                                        \[\leadsto \color{blue}{\frac{\frac{{\ell}^{2}}{t}}{{k}^{4}} + \frac{\frac{{\ell}^{2}}{t}}{{k}^{4}}} \]
                                                                                                      6. associate-/r*N/A

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

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

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

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

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

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

                                                                                                        \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \frac{\color{blue}{\ell \cdot \ell}}{{k}^{4} \cdot t} \]
                                                                                                      13. associate-/l*N/A

                                                                                                        \[\leadsto \ell \cdot \frac{\ell}{{k}^{4} \cdot t} + \color{blue}{\ell \cdot \frac{\ell}{{k}^{4} \cdot t}} \]
                                                                                                      14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

                                                                                                        Reproduce

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