Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.3% → 94.0%
Time: 21.6s
Alternatives: 15
Speedup: 15.1×

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

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

Initial Program: 36.3% 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: 94.0% accurate, 1.4× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \leq 2.4 \cdot 10^{+60}:\\ \;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (t l_m k)
 :precision binary64
 (if (<= l_m 2.4e+60)
   (* (* (/ (cos k) (* k (* k t))) (ratio-of-squares l_m (sin k))) 2.0)
   (* (/ (* (ratio-of-squares l_m k) (cos k)) (* (pow (sin k) 2.0) t)) 2.0)))
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;l\_m \leq 2.4 \cdot 10^{+60}:\\
\;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 2.4e60

    1. Initial program 35.7%

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      3. associate-*l*N/A

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

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lower-*.f6489.8

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
    7. Applied rewrites89.8%

      \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]

    if 2.4e60 < l

    1. Initial program 42.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lift-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
      19. lower-/.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
    7. Applied rewrites97.4%

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      7. associate-*r/N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      8. lower-/.f64N/A

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

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

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      11. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      12. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      13. lift-*.f6497.3

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
    9. Applied rewrites97.3%

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

Alternative 2: 93.6% accurate, 1.9× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \leq 5.2 \cdot 10^{+75}:\\ \;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \frac{\cos k}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (t l_m k)
 :precision binary64
 (if (<= l_m 5.2e+75)
   (* (* (/ (cos k) (* k (* k t))) (ratio-of-squares l_m (sin k))) 2.0)
   (*
    (*
     (ratio-of-squares l_m k)
     (/ (cos k) (* (- 0.5 (* 0.5 (cos (* 2.0 k)))) t)))
    2.0)))
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;l\_m \leq 5.2 \cdot 10^{+75}:\\
\;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \frac{\cos k}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.1999999999999997e75

    1. Initial program 35.8%

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      3. associate-*l*N/A

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

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lower-*.f6489.9

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
    7. Applied rewrites89.9%

      \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]

    if 5.1999999999999997e75 < l

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lift-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
      19. lower-/.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
    7. Applied rewrites97.3%

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      3. pow2N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(\sin k \cdot \sin k\right) \cdot t}\right) \cdot 2 \]
      4. sqr-sin-aN/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2 \]
      5. lower--.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2 \]
      7. lower-cos.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2 \]
      8. lower-*.f6497.2

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot t}\right) \cdot 2 \]
    9. Applied rewrites97.2%

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

Alternative 3: 93.6% accurate, 1.9× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \leq 5.2 \cdot 10^{+75}:\\ \;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \cos k}{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t} \cdot 2\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (t l_m k)
 :precision binary64
 (if (<= l_m 5.2e+75)
   (* (* (/ (cos k) (* k (* k t))) (ratio-of-squares l_m (sin k))) 2.0)
   (*
    (/
     (* (ratio-of-squares l_m k) (cos k))
     (* (- 0.5 (* 0.5 (cos (+ k k)))) t))
    2.0)))
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;l\_m \leq 5.2 \cdot 10^{+75}:\\
\;\;\;\;\left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \cos k}{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t} \cdot 2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.1999999999999997e75

    1. Initial program 35.8%

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      3. associate-*l*N/A

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

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lower-*.f6489.9

        \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
    7. Applied rewrites89.9%

      \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]

    if 5.1999999999999997e75 < l

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
      5. lift-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
      19. lower-/.f64N/A

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
    7. Applied rewrites97.3%

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
      7. associate-*r/N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      8. lower-/.f64N/A

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

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

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      11. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      12. lift-pow.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      13. lift-*.f6497.3

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
    9. Applied rewrites97.3%

      \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
    10. Step-by-step derivation
      1. lift-pow.f64N/A

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

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      3. pow2N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\sin k \cdot \sin k\right) \cdot t} \cdot 2 \]
      4. sqr-sin-aN/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t} \cdot 2 \]
      5. lower--.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t} \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot k\right)\right) \cdot t} \cdot 2 \]
      7. cos-2N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \left(\cos k \cdot \cos k - \sin k \cdot \sin k\right)\right) \cdot t} \cdot 2 \]
      8. cos-sumN/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \cdot 2 \]
      9. lower-cos.f64N/A

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(k + k\right)\right) \cdot t} \cdot 2 \]
      10. lower-+.f6496.9

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t} \cdot 2 \]
    11. Applied rewrites96.9%

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

Alternative 4: 83.2% accurate, 1.9× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;k \leq 2.75 \cdot 10^{-46}:\\ \;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{1} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), \sin k\right) \cdot \frac{\cos k}{t}\right) \cdot 2\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
(FPCore (t l_m k)
 :precision binary64
 (if (<= k 2.75e-46)
   (/ 2.0 (* (/ (* k (* k t)) 1.0) (ratio-of-squares (sin k) l_m)))
   (* (* (ratio-of-squares (/ l_m k) (sin k)) (/ (cos k) t)) 2.0)))
\begin{array}{l}
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.75 \cdot 10^{-46}:\\
\;\;\;\;\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{1} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), \sin k\right) \cdot \frac{\cos k}{t}\right) \cdot 2\\


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

    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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \color{blue}{\ell}\right)} \]
      13. lift-sin.f6485.9

        \[\leadsto \frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
    5. Applied rewrites85.9%

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

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

        \[\leadsto \frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
      3. associate-*l*N/A

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

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin \color{blue}{k}, \ell\right)} \]
      5. lower-*.f6490.2

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
    7. Applied rewrites90.2%

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

      \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{1} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
    9. Step-by-step derivation
      1. Applied rewrites83.8%

        \[\leadsto \frac{2}{\frac{k \cdot \left(k \cdot t\right)}{1} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]

      if 2.74999999999999992e-46 < k

      1. Initial program 25.7%

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

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
        5. lift-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
        19. lower-/.f64N/A

          \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
      7. Applied rewrites93.8%

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
        7. associate-*r/N/A

          \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
        8. lower-/.f64N/A

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

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

          \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
        11. lift-sin.f64N/A

          \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
        12. lift-pow.f64N/A

          \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
        13. lift-*.f6494.0

          \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      9. Applied rewrites94.0%

        \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \cos k}{{\sin k}^{2} \cdot t} \cdot 2 \]
      10. Step-by-step derivation
        1. Applied rewrites95.0%

          \[\leadsto \color{blue}{\left(\mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), \sin k\right) \cdot \frac{\cos k}{t}\right) \cdot 2} \]
      11. Recombined 2 regimes into one program.
      12. Add Preprocessing

      Alternative 5: 77.0% accurate, 1.9× speedup?

      \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \cdot l\_m \leq 10^{-273}:\\ \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \frac{1}{{\sin k}^{2} \cdot t}\right) \cdot 2\\ \end{array} \end{array} \]
      l_m = (fabs.f64 l)
      (FPCore (t l_m k)
       :precision binary64
       (if (<= (* l_m l_m) 1e-273)
         (/ (* 2.0 (ratio-of-squares (/ l_m k) k)) t)
         (* (* (ratio-of-squares l_m k) (/ 1.0 (* (pow (sin k) 2.0) t))) 2.0)))
      \begin{array}{l}
      l_m = \left|\ell\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;l\_m \cdot l\_m \leq 10^{-273}:\\
      \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \frac{1}{{\sin k}^{2} \cdot t}\right) \cdot 2\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 l l) < 1e-273

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
          10. unpow2N/A

            \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
          11. lower-*.f6444.3

            \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
        5. Applied rewrites44.3%

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

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

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

            \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
          4. lift-ratio-of-squares.f64N/A

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

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

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

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

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
          9. lift-*.f6444.3

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
        7. Applied rewrites44.3%

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

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
          2. pow2N/A

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left({k}^{2}\right)\right)}{t} \]
          3. lower-ratio-of-squares.f64N/A

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

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

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

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

            \[\leadsto \frac{2 \cdot \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{k}^{2}}}{t} \]
          8. times-fracN/A

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

            \[\leadsto \frac{2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot k}}{t} \]
          10. lower-ratio-of-squares.f64N/A

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
          11. lower-/.f6496.4

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
        9. Applied rewrites96.4%

          \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]

        if 1e-273 < (*.f64 l l)

        1. Initial program 40.7%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
          5. lift-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
          19. lower-/.f64N/A

            \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{\cos k}{t \cdot {\sin k}^{2}}\right) \cdot 2 \]
        7. Applied rewrites96.5%

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

          \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{1}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
        9. Step-by-step derivation
          1. Applied rewrites72.3%

            \[\leadsto \left(\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot \frac{1}{{\sin k}^{2} \cdot t}\right) \cdot 2 \]
        10. Recombined 2 regimes into one program.
        11. Add Preprocessing

        Alternative 6: 85.2% accurate, 2.0× speedup?

        \[\begin{array}{l} l_m = \left|\ell\right| \\ \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2 \end{array} \]
        l_m = (fabs.f64 l)
        (FPCore (t l_m k)
         :precision binary64
         (* (* (/ (cos k) (* k (* k t))) (ratio-of-squares l_m (sin k))) 2.0))
        \begin{array}{l}
        l_m = \left|\ell\right|
        
        \\
        \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2
        \end{array}
        
        Derivation
        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 \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

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

            \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
          3. associate-*l*N/A

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

            \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
          5. lower-*.f6487.0

            \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
        7. Applied rewrites87.0%

          \[\leadsto \left(\frac{\cos k}{k \cdot \left(k \cdot t\right)} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \sin k\right)\right) \cdot 2 \]
        8. Add Preprocessing

        Alternative 7: 76.6% accurate, 3.2× speedup?

        \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \cdot l\_m \leq 10^{-273}:\\ \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, k\right)\right) \cdot 2\\ \end{array} \end{array} \]
        l_m = (fabs.f64 l)
        (FPCore (t l_m k)
         :precision binary64
         (if (<= (* l_m l_m) 1e-273)
           (/ (* 2.0 (ratio-of-squares (/ l_m k) k)) t)
           (* (* (/ (cos k) (* (* k k) t)) (ratio-of-squares l_m k)) 2.0)))
        \begin{array}{l}
        l_m = \left|\ell\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;l\_m \cdot l\_m \leq 10^{-273}:\\
        \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, k\right)\right) \cdot 2\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 l l) < 1e-273

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
            10. unpow2N/A

              \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
            11. lower-*.f6444.3

              \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
          5. Applied rewrites44.3%

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

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

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

              \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
            4. lift-ratio-of-squares.f64N/A

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

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

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

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

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
            9. lift-*.f6444.3

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
          7. Applied rewrites44.3%

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

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
            2. pow2N/A

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left({k}^{2}\right)\right)}{t} \]
            3. lower-ratio-of-squares.f64N/A

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

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

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

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

              \[\leadsto \frac{2 \cdot \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{k}^{2}}}{t} \]
            8. times-fracN/A

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

              \[\leadsto \frac{2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot k}}{t} \]
            10. lower-ratio-of-squares.f64N/A

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
            11. lower-/.f6496.4

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
          9. Applied rewrites96.4%

            \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]

          if 1e-273 < (*.f64 l l)

          1. Initial program 40.7%

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

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

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

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

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

            \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, k\right)\right) \cdot 2 \]
          7. Step-by-step derivation
            1. Applied rewrites72.3%

              \[\leadsto \left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, k\right)\right) \cdot 2 \]
          8. Recombined 2 regimes into one program.
          9. Add Preprocessing

          Alternative 8: 75.4% accurate, 3.3× speedup?

          \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \cdot l\_m \leq 2 \cdot 10^{-313}:\\ \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}\\ \end{array} \end{array} \]
          l_m = (fabs.f64 l)
          (FPCore (t l_m k)
           :precision binary64
           (if (<= (* l_m l_m) 2e-313)
             (/ (* 2.0 (ratio-of-squares (/ l_m k) k)) t)
             (/ 2.0 (* (* (* k k) t) (ratio-of-squares (sin k) l_m)))))
          \begin{array}{l}
          l_m = \left|\ell\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;l\_m \cdot l\_m \leq 2 \cdot 10^{-313}:\\
          \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 l l) < 1.99999999998e-313

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
              10. unpow2N/A

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              11. lower-*.f6445.7

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
            5. Applied rewrites45.7%

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

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

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

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              4. lift-ratio-of-squares.f64N/A

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

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

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

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

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
              9. lift-*.f6445.7

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
            7. Applied rewrites45.7%

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

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
              2. pow2N/A

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left({k}^{2}\right)\right)}{t} \]
              3. lower-ratio-of-squares.f64N/A

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

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

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

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

                \[\leadsto \frac{2 \cdot \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{k}^{2}}}{t} \]
              8. times-fracN/A

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

                \[\leadsto \frac{2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot k}}{t} \]
              10. lower-ratio-of-squares.f64N/A

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
              11. lower-/.f6495.9

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
            9. Applied rewrites95.9%

              \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]

            if 1.99999999998e-313 < (*.f64 l l)

            1. Initial program 41.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \color{blue}{\ell}\right)} \]
              13. lift-sin.f6480.8

                \[\leadsto \frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
            5. Applied rewrites80.8%

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

              \[\leadsto \frac{2}{\left({k}^{2} \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\color{blue}{\sin k}, \ell\right)} \]
            7. Step-by-step derivation
              1. pow2N/A

                \[\leadsto \frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
              3. lift-*.f6471.0

                \[\leadsto \frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, \ell\right)} \]
            8. Applied rewrites71.0%

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

          Alternative 9: 74.2% accurate, 7.7× speedup?

          \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \frac{l\_m}{k \cdot k}\\ \mathbf{if}\;k \leq 1800:\\ \;\;\;\;\frac{2}{t} \cdot \left(t\_1 \cdot t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\ \end{array} \end{array} \]
          l_m = (fabs.f64 l)
          (FPCore (t l_m k)
           :precision binary64
           (let* ((t_1 (/ l_m (* k k))))
             (if (<= k 1800.0)
               (* (/ 2.0 t) (* t_1 t_1))
               (* (/ (* (ratio-of-squares l_m k) -0.16666666666666666) t) 2.0))))
          \begin{array}{l}
          l_m = \left|\ell\right|
          
          \\
          \begin{array}{l}
          t_1 := \frac{l\_m}{k \cdot k}\\
          \mathbf{if}\;k \leq 1800:\\
          \;\;\;\;\frac{2}{t} \cdot \left(t\_1 \cdot t\_1\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if k < 1800

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
              10. unpow2N/A

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              11. lower-*.f6432.7

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
            5. Applied rewrites32.7%

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

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              2. pow2N/A

                \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left({k}^{\color{blue}{2}}\right)\right) \]
              3. lower-ratio-of-squares.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \frac{2}{t} \cdot \left(\frac{\ell}{k \cdot k} \cdot \frac{\ell}{k \cdot \color{blue}{k}}\right) \]
              11. lift-*.f6481.8

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

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

            if 1800 < k

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

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

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

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

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

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

              \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
            9. Taylor expanded in k around inf

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

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

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

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

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

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

                \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
              7. lower-/.f6464.1

                \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
            11. Applied rewrites64.1%

              \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
            12. Step-by-step derivation
              1. Applied rewrites64.1%

                \[\leadsto \color{blue}{\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot -0.16666666666666666}{t} \cdot 2} \]
            13. Recombined 2 regimes into one program.
            14. Add Preprocessing

            Alternative 10: 75.1% accurate, 12.6× speedup?

            \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;l\_m \leq 4 \cdot 10^{-137}:\\ \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t}\\ \end{array} \end{array} \]
            l_m = (fabs.f64 l)
            (FPCore (t l_m k)
             :precision binary64
             (if (<= l_m 4e-137)
               (/ (* 2.0 (ratio-of-squares (/ l_m k) k)) t)
               (/ (* (ratio-of-squares l_m k) 2.0) (* (* k k) t))))
            \begin{array}{l}
            l_m = \left|\ell\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;l\_m \leq 4 \cdot 10^{-137}:\\
            \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{l\_m}{k}\right), k\right)}{t}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if l < 3.99999999999999991e-137

              1. Initial program 35.0%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
                10. unpow2N/A

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                11. lower-*.f6435.2

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              5. Applied rewrites35.2%

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                4. lift-ratio-of-squares.f64N/A

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

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

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

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

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
                9. lift-*.f6435.2

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
              7. Applied rewrites35.2%

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

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
                2. pow2N/A

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left({k}^{2}\right)\right)}{t} \]
                3. lower-ratio-of-squares.f64N/A

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

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

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

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

                  \[\leadsto \frac{2 \cdot \frac{\frac{\ell \cdot \ell}{k \cdot k}}{{k}^{2}}}{t} \]
                8. times-fracN/A

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

                  \[\leadsto \frac{2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{k \cdot k}}{t} \]
                10. lower-ratio-of-squares.f64N/A

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
                11. lower-/.f6475.4

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]
              9. Applied rewrites75.4%

                \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\left(\frac{\ell}{k}\right), k\right)}{t} \]

              if 3.99999999999999991e-137 < l

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
                10. unpow2N/A

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                11. lower-*.f6426.1

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              5. Applied rewrites26.1%

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                4. lift-ratio-of-squares.f64N/A

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

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

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

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

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

                  \[\leadsto \frac{\frac{{\ell}^{2}}{{k}^{2}}}{{k}^{2}} \cdot \frac{\color{blue}{2}}{t} \]
                10. frac-timesN/A

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

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

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

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

                  \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k} \cdot 2}{{k}^{2} \cdot t} \]
                15. lower-ratio-of-squares.f64N/A

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

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t} \]
                17. lift-*.f64N/A

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t} \]
                18. lift-*.f6467.2

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot \color{blue}{t}} \]
              7. Applied rewrites67.2%

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

            Alternative 11: 73.3% accurate, 13.0× speedup?

            \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;k \leq 1800:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\ \end{array} \end{array} \]
            l_m = (fabs.f64 l)
            (FPCore (t l_m k)
             :precision binary64
             (if (<= k 1800.0)
               (/ (* (ratio-of-squares l_m k) 2.0) (* (* k k) t))
               (* (/ (* (ratio-of-squares l_m k) -0.16666666666666666) t) 2.0)))
            \begin{array}{l}
            l_m = \left|\ell\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;k \leq 1800:\\
            \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if k < 1800

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
                10. unpow2N/A

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                11. lower-*.f6432.7

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
              5. Applied rewrites32.7%

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

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

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

                  \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                4. lift-ratio-of-squares.f64N/A

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

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

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

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

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

                  \[\leadsto \frac{\frac{{\ell}^{2}}{{k}^{2}}}{{k}^{2}} \cdot \frac{\color{blue}{2}}{t} \]
                10. frac-timesN/A

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

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

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

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

                  \[\leadsto \frac{\frac{\ell \cdot \ell}{k \cdot k} \cdot 2}{{k}^{2} \cdot t} \]
                15. lower-ratio-of-squares.f64N/A

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

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t} \]
                17. lift-*.f64N/A

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot t} \]
                18. lift-*.f6481.0

                  \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\left(k \cdot k\right) \cdot \color{blue}{t}} \]
              7. Applied rewrites81.0%

                \[\leadsto \frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot 2}{\color{blue}{\left(k \cdot k\right) \cdot t}} \]

              if 1800 < k

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

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

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

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

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

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

                \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
              9. Taylor expanded in k around inf

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

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

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

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

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

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

                  \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
                7. lower-/.f6464.1

                  \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
              11. Applied rewrites64.1%

                \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
              12. Step-by-step derivation
                1. Applied rewrites64.1%

                  \[\leadsto \color{blue}{\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot -0.16666666666666666}{t} \cdot 2} \]
              13. Recombined 2 regimes into one program.
              14. Add Preprocessing

              Alternative 12: 44.9% accurate, 15.1× speedup?

              \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;k \leq 1800:\\ \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\ \end{array} \end{array} \]
              l_m = (fabs.f64 l)
              (FPCore (t l_m k)
               :precision binary64
               (if (<= k 1800.0)
                 (/ (* 2.0 (ratio-of-squares l_m (* k k))) t)
                 (* (/ (* (ratio-of-squares l_m k) -0.16666666666666666) t) 2.0)))
              \begin{array}{l}
              l_m = \left|\ell\right|
              
              \\
              \begin{array}{l}
              \mathbf{if}\;k \leq 1800:\\
              \;\;\;\;\frac{2 \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)}{t}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if k < 1800

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
                  10. unpow2N/A

                    \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                  11. lower-*.f6432.7

                    \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                5. Applied rewrites32.7%

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

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

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

                    \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                  4. lift-ratio-of-squares.f64N/A

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

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

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

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

                    \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
                  9. lift-*.f6432.7

                    \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{t} \]
                7. Applied rewrites32.7%

                  \[\leadsto \frac{2 \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)}{\color{blue}{t}} \]

                if 1800 < k

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

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

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

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

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

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

                  \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
                9. Taylor expanded in k around inf

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

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

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

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

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

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

                    \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
                  7. lower-/.f6464.1

                    \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                11. Applied rewrites64.1%

                  \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                12. Step-by-step derivation
                  1. Applied rewrites64.1%

                    \[\leadsto \color{blue}{\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot -0.16666666666666666}{t} \cdot 2} \]
                13. Recombined 2 regimes into one program.
                14. Add Preprocessing

                Alternative 13: 44.9% accurate, 15.1× speedup?

                \[\begin{array}{l} l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;k \leq 1800:\\ \;\;\;\;\frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\ \end{array} \end{array} \]
                l_m = (fabs.f64 l)
                (FPCore (t l_m k)
                 :precision binary64
                 (if (<= k 1800.0)
                   (* (/ 2.0 t) (ratio-of-squares l_m (* k k)))
                   (* (/ (* (ratio-of-squares l_m k) -0.16666666666666666) t) 2.0)))
                \begin{array}{l}
                l_m = \left|\ell\right|
                
                \\
                \begin{array}{l}
                \mathbf{if}\;k \leq 1800:\\
                \;\;\;\;\frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if k < 1800

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \color{blue}{\left({k}^{2}\right)}\right) \]
                    10. unpow2N/A

                      \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                    11. lower-*.f6432.7

                      \[\leadsto \frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot \color{blue}{k}\right)\right) \]
                  5. Applied rewrites32.7%

                    \[\leadsto \color{blue}{\frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(\ell, \left(k \cdot k\right)\right)} \]

                  if 1800 < k

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

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

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

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

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

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

                    \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
                  9. Taylor expanded in k around inf

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

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

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

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

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

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

                      \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
                    7. lower-/.f6464.1

                      \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                  11. Applied rewrites64.1%

                    \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                  12. Step-by-step derivation
                    1. Applied rewrites64.1%

                      \[\leadsto \color{blue}{\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot -0.16666666666666666}{t} \cdot 2} \]
                  13. Recombined 2 regimes into one program.
                  14. Add Preprocessing

                  Alternative 14: 31.9% accurate, 18.8× speedup?

                  \[\begin{array}{l} l_m = \left|\ell\right| \\ \frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2 \end{array} \]
                  l_m = (fabs.f64 l)
                  (FPCore (t l_m k)
                   :precision binary64
                   (* (/ (* (ratio-of-squares l_m k) -0.16666666666666666) t) 2.0))
                  \begin{array}{l}
                  l_m = \left|\ell\right|
                  
                  \\
                  \frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot -0.16666666666666666}{t} \cdot 2
                  \end{array}
                  
                  Derivation
                  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 \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

                    \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
                  9. Taylor expanded in k around inf

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

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

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

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

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

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

                      \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
                    7. lower-/.f6431.2

                      \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                  11. Applied rewrites31.2%

                    \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                  12. Step-by-step derivation
                    1. Applied rewrites31.2%

                      \[\leadsto \color{blue}{\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right) \cdot -0.16666666666666666}{t} \cdot 2} \]
                    2. Add Preprocessing

                    Alternative 15: 31.9% accurate, 18.8× speedup?

                    \[\begin{array}{l} l_m = \left|\ell\right| \\ \left(\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \end{array} \]
                    l_m = (fabs.f64 l)
                    (FPCore (t l_m k)
                     :precision binary64
                     (* (* (/ (ratio-of-squares l_m k) t) -0.16666666666666666) 2.0))
                    \begin{array}{l}
                    l_m = \left|\ell\right|
                    
                    \\
                    \left(\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2
                    \end{array}
                    
                    Derivation
                    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 \color{blue}{2 \cdot \frac{{\ell}^{2} \cdot \cos k}{{k}^{2} \cdot \left(t \cdot {\sin k}^{2}\right)}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

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

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

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

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

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

                      \[\leadsto \frac{\left(\frac{\ell \cdot \ell}{t} \cdot -0.16666666666666666\right) \cdot \left(k \cdot k\right) + \frac{\ell \cdot \ell}{t}}{{k}^{4}} \cdot 2 \]
                    9. Taylor expanded in k around inf

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

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

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

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

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

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

                        \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot \frac{-1}{6}\right) \cdot 2 \]
                      7. lower-/.f6431.2

                        \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                    11. Applied rewrites31.2%

                      \[\leadsto \left(\frac{\mathsf{ratio\_of\_squares}\left(\ell, k\right)}{t} \cdot -0.16666666666666666\right) \cdot 2 \]
                    12. Add Preprocessing

                    Reproduce

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