Toniolo and Linder, Equation (10-)

Percentage Accurate: 36.1% → 85.6%
Time: 16.7s
Alternatives: 9
Speedup: 3.8×

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));
}
real(8) function code(t, l, k)
    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 9 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.1% 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));
}
real(8) function code(t, l, k)
    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: 85.6% accurate, 0.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := \ell \cdot \sqrt{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{{k}^{2} \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k \cdot {\ell}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \sin k} \cdot \sqrt{\frac{\cos k}{t\_m}}\right)}^{2}\\ \end{array} \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (let* ((t_2 (* l (sqrt 2.0))))
   (*
    t_s
    (if (<= (* l l) 5e-271)
      (pow (/ t_2 (* k (* k (sqrt t_m)))) 2.0)
      (if (<= (* l l) 1e+114)
        (/
         2.0
         (* (pow k 2.0) (/ (* t_m (pow (sin k) 2.0)) (* (cos k) (pow l 2.0)))))
        (pow (* (/ t_2 (* k (sin k))) (sqrt (/ (cos k) t_m))) 2.0))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow((t_2 / (k * (k * sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = 2.0 / (pow(k, 2.0) * ((t_m * pow(sin(k), 2.0)) / (cos(k) * pow(l, 2.0))));
	} else {
		tmp = pow(((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_2
    real(8) :: tmp
    t_2 = l * sqrt(2.0d0)
    if ((l * l) <= 5d-271) then
        tmp = (t_2 / (k * (k * sqrt(t_m)))) ** 2.0d0
    else if ((l * l) <= 1d+114) then
        tmp = 2.0d0 / ((k ** 2.0d0) * ((t_m * (sin(k) ** 2.0d0)) / (cos(k) * (l ** 2.0d0))))
    else
        tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ** 2.0d0
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * Math.sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow((t_2 / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = 2.0 / (Math.pow(k, 2.0) * ((t_m * Math.pow(Math.sin(k), 2.0)) / (Math.cos(k) * Math.pow(l, 2.0))));
	} else {
		tmp = Math.pow(((t_2 / (k * Math.sin(k))) * Math.sqrt((Math.cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	t_2 = l * math.sqrt(2.0)
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow((t_2 / (k * (k * math.sqrt(t_m)))), 2.0)
	elif (l * l) <= 1e+114:
		tmp = 2.0 / (math.pow(k, 2.0) * ((t_m * math.pow(math.sin(k), 2.0)) / (math.cos(k) * math.pow(l, 2.0))))
	else:
		tmp = math.pow(((t_2 / (k * math.sin(k))) * math.sqrt((math.cos(k) / t_m))), 2.0)
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	t_2 = Float64(l * sqrt(2.0))
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(t_2 / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	elseif (Float64(l * l) <= 1e+114)
		tmp = Float64(2.0 / Float64((k ^ 2.0) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / Float64(cos(k) * (l ^ 2.0)))));
	else
		tmp = Float64(Float64(t_2 / Float64(k * sin(k))) * sqrt(Float64(cos(k) / t_m))) ^ 2.0;
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	t_2 = l * sqrt(2.0);
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = (t_2 / (k * (k * sqrt(t_m)))) ^ 2.0;
	elseif ((l * l) <= 1e+114)
		tmp = 2.0 / ((k ^ 2.0) * ((t_m * (sin(k) ^ 2.0)) / (cos(k) * (l ^ 2.0))));
	else
		tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ^ 2.0;
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(t$95$2 / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 1e+114], N[(2.0 / N[(N[Power[k, 2.0], $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(t$95$2 / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Cos[k], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \ell \cdot \sqrt{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\
\;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\

\mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\
\;\;\;\;\frac{2}{{k}^{2} \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k \cdot {\ell}^{2}}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l) < 1e114

    1. Initial program 47.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified47.3%

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

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

        \[\leadsto \frac{2}{\color{blue}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{{\ell}^{2} \cdot \cos k}}} \]
      2. *-commutative98.2%

        \[\leadsto \frac{2}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{\color{blue}{\cos k \cdot {\ell}^{2}}}} \]
    6. Simplified98.2%

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

    if 1e114 < (*.f64 l l)

    1. Initial program 37.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. Simplified38.9%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt21.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr26.1%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Taylor expanded in l around 0 47.9%

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

Alternative 2: 86.4% accurate, 0.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := \ell \cdot \sqrt{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+290}:\\ \;\;\;\;\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{{\sin k}^{2} \cdot \frac{t\_m}{\cos k}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \sin k} \cdot \sqrt{\frac{\cos k}{t\_m}}\right)}^{2}\\ \end{array} \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (let* ((t_2 (* l (sqrt 2.0))))
   (*
    t_s
    (if (<= (* l l) 5e-271)
      (pow (/ t_2 (* k (* k (sqrt t_m)))) 2.0)
      (if (<= (* l l) 1e+290)
        (*
         (/ (pow l 2.0) (pow k 2.0))
         (/ 2.0 (* (pow (sin k) 2.0) (/ t_m (cos k)))))
        (pow (* (/ t_2 (* k (sin k))) (sqrt (/ (cos k) t_m))) 2.0))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow((t_2 / (k * (k * sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+290) {
		tmp = (pow(l, 2.0) / pow(k, 2.0)) * (2.0 / (pow(sin(k), 2.0) * (t_m / cos(k))));
	} else {
		tmp = pow(((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_2
    real(8) :: tmp
    t_2 = l * sqrt(2.0d0)
    if ((l * l) <= 5d-271) then
        tmp = (t_2 / (k * (k * sqrt(t_m)))) ** 2.0d0
    else if ((l * l) <= 1d+290) then
        tmp = ((l ** 2.0d0) / (k ** 2.0d0)) * (2.0d0 / ((sin(k) ** 2.0d0) * (t_m / cos(k))))
    else
        tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ** 2.0d0
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * Math.sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow((t_2 / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+290) {
		tmp = (Math.pow(l, 2.0) / Math.pow(k, 2.0)) * (2.0 / (Math.pow(Math.sin(k), 2.0) * (t_m / Math.cos(k))));
	} else {
		tmp = Math.pow(((t_2 / (k * Math.sin(k))) * Math.sqrt((Math.cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	t_2 = l * math.sqrt(2.0)
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow((t_2 / (k * (k * math.sqrt(t_m)))), 2.0)
	elif (l * l) <= 1e+290:
		tmp = (math.pow(l, 2.0) / math.pow(k, 2.0)) * (2.0 / (math.pow(math.sin(k), 2.0) * (t_m / math.cos(k))))
	else:
		tmp = math.pow(((t_2 / (k * math.sin(k))) * math.sqrt((math.cos(k) / t_m))), 2.0)
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	t_2 = Float64(l * sqrt(2.0))
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(t_2 / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	elseif (Float64(l * l) <= 1e+290)
		tmp = Float64(Float64((l ^ 2.0) / (k ^ 2.0)) * Float64(2.0 / Float64((sin(k) ^ 2.0) * Float64(t_m / cos(k)))));
	else
		tmp = Float64(Float64(t_2 / Float64(k * sin(k))) * sqrt(Float64(cos(k) / t_m))) ^ 2.0;
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	t_2 = l * sqrt(2.0);
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = (t_2 / (k * (k * sqrt(t_m)))) ^ 2.0;
	elseif ((l * l) <= 1e+290)
		tmp = ((l ^ 2.0) / (k ^ 2.0)) * (2.0 / ((sin(k) ^ 2.0) * (t_m / cos(k))));
	else
		tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ^ 2.0;
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(t$95$2 / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 1e+290], N[(N[(N[Power[l, 2.0], $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(t$95$2 / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Cos[k], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \ell \cdot \sqrt{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\
\;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\

\mathbf{elif}\;\ell \cdot \ell \leq 10^{+290}:\\
\;\;\;\;\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{{\sin k}^{2} \cdot \frac{t\_m}{\cos k}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l) < 1.00000000000000006e290

    1. Initial program 42.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. Simplified50.4%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 86.7%

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

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

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

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

        \[\leadsto \frac{2 \cdot \color{blue}{{\ell}^{2}}}{{k}^{2} \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}} \]
      3. associate-/l*86.7%

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

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

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

        \[\leadsto \color{blue}{\frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{t \cdot \frac{{\sin k}^{2}}{\cos k}}} \]
      3. associate-*r/89.1%

        \[\leadsto \frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{\color{blue}{\frac{t \cdot {\sin k}^{2}}{\cos k}}} \]
      4. *-commutative89.1%

        \[\leadsto \frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{\frac{\color{blue}{{\sin k}^{2} \cdot t}}{\cos k}} \]
      5. associate-/l*89.1%

        \[\leadsto \frac{{\ell}^{2}}{{k}^{2}} \cdot \frac{2}{\color{blue}{{\sin k}^{2} \cdot \frac{t}{\cos k}}} \]
    10. Simplified89.1%

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

    if 1.00000000000000006e290 < (*.f64 l l)

    1. Initial program 39.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. Simplified39.4%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt20.4%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr26.2%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Taylor expanded in l around 0 46.3%

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

Alternative 3: 85.8% accurate, 0.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := \ell \cdot \sqrt{2}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t\_2}{k \cdot \sin k} \cdot \sqrt{\frac{\cos k}{t\_m}}\right)}^{2}\\ \end{array} \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (let* ((t_2 (* l (sqrt 2.0))))
   (*
    t_s
    (if (<= (* l l) 5e-271)
      (pow (/ t_2 (* k (* k (sqrt t_m)))) 2.0)
      (if (<= (* l l) 1e+114)
        (*
         (/ 2.0 (* t_m (* k k)))
         (/ (* (cos k) (pow l 2.0)) (pow (sin k) 2.0)))
        (pow (* (/ t_2 (* k (sin k))) (sqrt (/ (cos k) t_m))) 2.0))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow((t_2 / (k * (k * sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * pow(l, 2.0)) / pow(sin(k), 2.0));
	} else {
		tmp = pow(((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: t_2
    real(8) :: tmp
    t_2 = l * sqrt(2.0d0)
    if ((l * l) <= 5d-271) then
        tmp = (t_2 / (k * (k * sqrt(t_m)))) ** 2.0d0
    else if ((l * l) <= 1d+114) then
        tmp = (2.0d0 / (t_m * (k * k))) * ((cos(k) * (l ** 2.0d0)) / (sin(k) ** 2.0d0))
    else
        tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ** 2.0d0
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double t_2 = l * Math.sqrt(2.0);
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow((t_2 / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((Math.cos(k) * Math.pow(l, 2.0)) / Math.pow(Math.sin(k), 2.0));
	} else {
		tmp = Math.pow(((t_2 / (k * Math.sin(k))) * Math.sqrt((Math.cos(k) / t_m))), 2.0);
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	t_2 = l * math.sqrt(2.0)
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow((t_2 / (k * (k * math.sqrt(t_m)))), 2.0)
	elif (l * l) <= 1e+114:
		tmp = (2.0 / (t_m * (k * k))) * ((math.cos(k) * math.pow(l, 2.0)) / math.pow(math.sin(k), 2.0))
	else:
		tmp = math.pow(((t_2 / (k * math.sin(k))) * math.sqrt((math.cos(k) / t_m))), 2.0)
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	t_2 = Float64(l * sqrt(2.0))
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(t_2 / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	elseif (Float64(l * l) <= 1e+114)
		tmp = Float64(Float64(2.0 / Float64(t_m * Float64(k * k))) * Float64(Float64(cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0)));
	else
		tmp = Float64(Float64(t_2 / Float64(k * sin(k))) * sqrt(Float64(cos(k) / t_m))) ^ 2.0;
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	t_2 = l * sqrt(2.0);
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = (t_2 / (k * (k * sqrt(t_m)))) ^ 2.0;
	elseif ((l * l) <= 1e+114)
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0));
	else
		tmp = ((t_2 / (k * sin(k))) * sqrt((cos(k) / t_m))) ^ 2.0;
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(t$95$2 / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 1e+114], N[(N[(2.0 / N[(t$95$m * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(t$95$2 / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Cos[k], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \ell \cdot \sqrt{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\
\;\;\;\;{\left(\frac{t\_2}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\

\mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\
\;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l) < 1e114

    1. Initial program 47.3%

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

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 94.1%

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

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

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

        \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{{\ell}^{2} \cdot \cos k}{{\sin k}^{2}}} \]
      4. *-commutative96.9%

        \[\leadsto \frac{2}{{k}^{2} \cdot t} \cdot \frac{\color{blue}{\cos k \cdot {\ell}^{2}}}{{\sin k}^{2}} \]
    6. Simplified96.9%

      \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}} \]
    7. Step-by-step derivation
      1. unpow296.9%

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

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

    if 1e114 < (*.f64 l l)

    1. Initial program 37.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. Simplified38.9%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt21.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr26.1%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Taylor expanded in l around 0 47.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \sin k} \cdot \sqrt{\frac{\cos k}{t}}\right)}^{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.8% accurate, 0.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\frac{\cos k}{t\_m}} \cdot \left(\frac{\sqrt{2}}{k} \cdot \frac{\ell}{\sin k}\right)\right)}^{2}\\ \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (*
  t_s
  (if (<= (* l l) 5e-271)
    (pow (/ (* l (sqrt 2.0)) (* k (* k (sqrt t_m)))) 2.0)
    (if (<= (* l l) 1e+114)
      (* (/ 2.0 (* t_m (* k k))) (/ (* (cos k) (pow l 2.0)) (pow (sin k) 2.0)))
      (pow
       (* (sqrt (/ (cos k) t_m)) (* (/ (sqrt 2.0) k) (/ l (sin k))))
       2.0)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow(((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * pow(l, 2.0)) / pow(sin(k), 2.0));
	} else {
		tmp = pow((sqrt((cos(k) / t_m)) * ((sqrt(2.0) / k) * (l / sin(k)))), 2.0);
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if ((l * l) <= 5d-271) then
        tmp = ((l * sqrt(2.0d0)) / (k * (k * sqrt(t_m)))) ** 2.0d0
    else if ((l * l) <= 1d+114) then
        tmp = (2.0d0 / (t_m * (k * k))) * ((cos(k) * (l ** 2.0d0)) / (sin(k) ** 2.0d0))
    else
        tmp = (sqrt((cos(k) / t_m)) * ((sqrt(2.0d0) / k) * (l / sin(k)))) ** 2.0d0
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow(((l * Math.sqrt(2.0)) / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((Math.cos(k) * Math.pow(l, 2.0)) / Math.pow(Math.sin(k), 2.0));
	} else {
		tmp = Math.pow((Math.sqrt((Math.cos(k) / t_m)) * ((Math.sqrt(2.0) / k) * (l / Math.sin(k)))), 2.0);
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow(((l * math.sqrt(2.0)) / (k * (k * math.sqrt(t_m)))), 2.0)
	elif (l * l) <= 1e+114:
		tmp = (2.0 / (t_m * (k * k))) * ((math.cos(k) * math.pow(l, 2.0)) / math.pow(math.sin(k), 2.0))
	else:
		tmp = math.pow((math.sqrt((math.cos(k) / t_m)) * ((math.sqrt(2.0) / k) * (l / math.sin(k)))), 2.0)
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(Float64(l * sqrt(2.0)) / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	elseif (Float64(l * l) <= 1e+114)
		tmp = Float64(Float64(2.0 / Float64(t_m * Float64(k * k))) * Float64(Float64(cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0)));
	else
		tmp = Float64(sqrt(Float64(cos(k) / t_m)) * Float64(Float64(sqrt(2.0) / k) * Float64(l / sin(k)))) ^ 2.0;
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = ((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))) ^ 2.0;
	elseif ((l * l) <= 1e+114)
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0));
	else
		tmp = (sqrt((cos(k) / t_m)) * ((sqrt(2.0) / k) * (l / sin(k)))) ^ 2.0;
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 1e+114], N[(N[(2.0 / N[(t$95$m * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Sqrt[N[(N[Cos[k], $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] / k), $MachinePrecision] * N[(l / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

\mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\
\;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l) < 1e114

    1. Initial program 47.3%

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

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 94.1%

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

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

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

        \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{{\ell}^{2} \cdot \cos k}{{\sin k}^{2}}} \]
      4. *-commutative96.9%

        \[\leadsto \frac{2}{{k}^{2} \cdot t} \cdot \frac{\color{blue}{\cos k \cdot {\ell}^{2}}}{{\sin k}^{2}} \]
    6. Simplified96.9%

      \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}} \]
    7. Step-by-step derivation
      1. unpow296.9%

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

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

    if 1e114 < (*.f64 l l)

    1. Initial program 37.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. Simplified38.9%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt21.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr26.1%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Taylor expanded in l around 0 47.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\frac{\cos k}{t}} \cdot \left(\frac{\sqrt{2}}{k} \cdot \frac{\ell}{\sin k}\right)\right)}^{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.3% accurate, 0.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\ell \cdot \frac{\sqrt{2}}{k \cdot \left(\sin k \cdot \sqrt{\frac{t\_m}{\cos k}}\right)}\right)}^{2}\\ \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (*
  t_s
  (if (<= (* l l) 5e-271)
    (pow (/ (* l (sqrt 2.0)) (* k (* k (sqrt t_m)))) 2.0)
    (if (<= (* l l) 1e+114)
      (* (/ 2.0 (* t_m (* k k))) (/ (* (cos k) (pow l 2.0)) (pow (sin k) 2.0)))
      (pow
       (* l (/ (sqrt 2.0) (* k (* (sin k) (sqrt (/ t_m (cos k)))))))
       2.0)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow(((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * pow(l, 2.0)) / pow(sin(k), 2.0));
	} else {
		tmp = pow((l * (sqrt(2.0) / (k * (sin(k) * sqrt((t_m / cos(k))))))), 2.0);
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if ((l * l) <= 5d-271) then
        tmp = ((l * sqrt(2.0d0)) / (k * (k * sqrt(t_m)))) ** 2.0d0
    else if ((l * l) <= 1d+114) then
        tmp = (2.0d0 / (t_m * (k * k))) * ((cos(k) * (l ** 2.0d0)) / (sin(k) ** 2.0d0))
    else
        tmp = (l * (sqrt(2.0d0) / (k * (sin(k) * sqrt((t_m / cos(k))))))) ** 2.0d0
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow(((l * Math.sqrt(2.0)) / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else if ((l * l) <= 1e+114) {
		tmp = (2.0 / (t_m * (k * k))) * ((Math.cos(k) * Math.pow(l, 2.0)) / Math.pow(Math.sin(k), 2.0));
	} else {
		tmp = Math.pow((l * (Math.sqrt(2.0) / (k * (Math.sin(k) * Math.sqrt((t_m / Math.cos(k))))))), 2.0);
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow(((l * math.sqrt(2.0)) / (k * (k * math.sqrt(t_m)))), 2.0)
	elif (l * l) <= 1e+114:
		tmp = (2.0 / (t_m * (k * k))) * ((math.cos(k) * math.pow(l, 2.0)) / math.pow(math.sin(k), 2.0))
	else:
		tmp = math.pow((l * (math.sqrt(2.0) / (k * (math.sin(k) * math.sqrt((t_m / math.cos(k))))))), 2.0)
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(Float64(l * sqrt(2.0)) / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	elseif (Float64(l * l) <= 1e+114)
		tmp = Float64(Float64(2.0 / Float64(t_m * Float64(k * k))) * Float64(Float64(cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0)));
	else
		tmp = Float64(l * Float64(sqrt(2.0) / Float64(k * Float64(sin(k) * sqrt(Float64(t_m / cos(k))))))) ^ 2.0;
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = ((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))) ^ 2.0;
	elseif ((l * l) <= 1e+114)
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0));
	else
		tmp = (l * (sqrt(2.0) / (k * (sin(k) * sqrt((t_m / cos(k))))))) ^ 2.0;
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 1e+114], N[(N[(2.0 / N[(t$95$m * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(l * N[(N[Sqrt[2.0], $MachinePrecision] / N[(k * N[(N[Sin[k], $MachinePrecision] * N[Sqrt[N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

\mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\
\;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l) < 1e114

    1. Initial program 47.3%

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

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 94.1%

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

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

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

        \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{{\ell}^{2} \cdot \cos k}{{\sin k}^{2}}} \]
      4. *-commutative96.9%

        \[\leadsto \frac{2}{{k}^{2} \cdot t} \cdot \frac{\color{blue}{\cos k \cdot {\ell}^{2}}}{{\sin k}^{2}} \]
    6. Simplified96.9%

      \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}} \]
    7. Step-by-step derivation
      1. unpow296.9%

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

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

    if 1e114 < (*.f64 l l)

    1. Initial program 37.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. Simplified38.9%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt21.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr26.1%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Taylor expanded in k around inf 47.0%

      \[\leadsto {\left(\ell \cdot \frac{\sqrt{2}}{\color{blue}{\left(k \cdot \sin k\right) \cdot \sqrt{\frac{t}{\cos k}}}}\right)}^{2} \]
    7. Step-by-step derivation
      1. associate-*l*47.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t}\right)}\right)}^{2}\\ \mathbf{elif}\;\ell \cdot \ell \leq 10^{+114}:\\ \;\;\;\;\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\ell \cdot \frac{\sqrt{2}}{k \cdot \left(\sin k \cdot \sqrt{\frac{t}{\cos k}}\right)}\right)}^{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 83.1% accurate, 1.0× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t\_m \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (*
  t_s
  (if (<= (* l l) 5e-271)
    (pow (/ (* l (sqrt 2.0)) (* k (* k (sqrt t_m)))) 2.0)
    (*
     (/ 2.0 (* t_m (* k k)))
     (/ (* (cos k) (pow l 2.0)) (pow (sin k) 2.0))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = pow(((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))), 2.0);
	} else {
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * pow(l, 2.0)) / pow(sin(k), 2.0));
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if ((l * l) <= 5d-271) then
        tmp = ((l * sqrt(2.0d0)) / (k * (k * sqrt(t_m)))) ** 2.0d0
    else
        tmp = (2.0d0 / (t_m * (k * k))) * ((cos(k) * (l ** 2.0d0)) / (sin(k) ** 2.0d0))
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if ((l * l) <= 5e-271) {
		tmp = Math.pow(((l * Math.sqrt(2.0)) / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else {
		tmp = (2.0 / (t_m * (k * k))) * ((Math.cos(k) * Math.pow(l, 2.0)) / Math.pow(Math.sin(k), 2.0));
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	tmp = 0
	if (l * l) <= 5e-271:
		tmp = math.pow(((l * math.sqrt(2.0)) / (k * (k * math.sqrt(t_m)))), 2.0)
	else:
		tmp = (2.0 / (t_m * (k * k))) * ((math.cos(k) * math.pow(l, 2.0)) / math.pow(math.sin(k), 2.0))
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	tmp = 0.0
	if (Float64(l * l) <= 5e-271)
		tmp = Float64(Float64(l * sqrt(2.0)) / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	else
		tmp = Float64(Float64(2.0 / Float64(t_m * Float64(k * k))) * Float64(Float64(cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0)));
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	tmp = 0.0;
	if ((l * l) <= 5e-271)
		tmp = ((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))) ^ 2.0;
	else
		tmp = (2.0 / (t_m * (k * k))) * ((cos(k) * (l ^ 2.0)) / (sin(k) ^ 2.0));
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[N[(l * l), $MachinePrecision], 5e-271], N[Power[N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(2.0 / N[(t$95$m * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 l l) < 5.0000000000000002e-271

    1. Initial program 28.3%

      \[\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)} \]
    2. Simplified38.8%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt37.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr39.5%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/39.4%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.3%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.3%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 58.6%

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

    if 5.0000000000000002e-271 < (*.f64 l l)

    1. Initial program 41.3%

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

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 79.3%

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

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

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

        \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{{\ell}^{2} \cdot \cos k}{{\sin k}^{2}}} \]
      4. *-commutative80.4%

        \[\leadsto \frac{2}{{k}^{2} \cdot t} \cdot \frac{\color{blue}{\cos k \cdot {\ell}^{2}}}{{\sin k}^{2}} \]
    6. Simplified80.4%

      \[\leadsto \color{blue}{\frac{2}{{k}^{2} \cdot t} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}} \]
    7. Step-by-step derivation
      1. unpow280.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{-271}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t}\right)}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{t \cdot \left(k \cdot k\right)} \cdot \frac{\cos k \cdot {\ell}^{2}}{{\sin k}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 79.5% accurate, 1.3× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;k \leq 1.85 \cdot 10^{-14}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{\left(k \cdot k\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\ \end{array} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (*
  t_s
  (if (<= k 1.85e-14)
    (pow (/ (* l (sqrt 2.0)) (* k (* k (sqrt t_m)))) 2.0)
    (* (* l l) (/ 2.0 (* (* k k) (/ (* t_m (pow (sin k) 2.0)) (cos k))))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if (k <= 1.85e-14) {
		tmp = pow(((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / ((k * k) * ((t_m * pow(sin(k), 2.0)) / cos(k))));
	}
	return t_s * tmp;
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8) :: tmp
    if (k <= 1.85d-14) then
        tmp = ((l * sqrt(2.0d0)) / (k * (k * sqrt(t_m)))) ** 2.0d0
    else
        tmp = (l * l) * (2.0d0 / ((k * k) * ((t_m * (sin(k) ** 2.0d0)) / cos(k))))
    end if
    code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	double tmp;
	if (k <= 1.85e-14) {
		tmp = Math.pow(((l * Math.sqrt(2.0)) / (k * (k * Math.sqrt(t_m)))), 2.0);
	} else {
		tmp = (l * l) * (2.0 / ((k * k) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k))));
	}
	return t_s * tmp;
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	tmp = 0
	if k <= 1.85e-14:
		tmp = math.pow(((l * math.sqrt(2.0)) / (k * (k * math.sqrt(t_m)))), 2.0)
	else:
		tmp = (l * l) * (2.0 / ((k * k) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))))
	return t_s * tmp
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	tmp = 0.0
	if (k <= 1.85e-14)
		tmp = Float64(Float64(l * sqrt(2.0)) / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0;
	else
		tmp = Float64(Float64(l * l) * Float64(2.0 / Float64(Float64(k * k) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))));
	end
	return Float64(t_s * tmp)
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, t_m, l, k)
	tmp = 0.0;
	if (k <= 1.85e-14)
		tmp = ((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))) ^ 2.0;
	else
		tmp = (l * l) * (2.0 / ((k * k) * ((t_m * (sin(k) ^ 2.0)) / cos(k))));
	end
	tmp_2 = t_s * tmp;
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[k, 1.85e-14], N[Power[N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(l * l), $MachinePrecision] * N[(2.0 / N[(N[(k * k), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

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

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


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

    1. Initial program 38.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. Simplified44.0%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt29.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
    5. Applied egg-rr40.1%

      \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
    6. Step-by-step derivation
      1. associate-*r/40.1%

        \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
      2. associate-*l*41.8%

        \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
    7. Applied egg-rr41.8%

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

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
    9. Taylor expanded in k around 0 49.6%

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

    if 1.85000000000000001e-14 < k

    1. Initial program 33.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. Simplified42.3%

      \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 74.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1.85 \cdot 10^{-14}:\\ \;\;\;\;{\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t}\right)}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\ell \cdot \ell\right) \cdot \frac{2}{\left(k \cdot k\right) \cdot \frac{t \cdot {\sin k}^{2}}{\cos k}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.2% accurate, 1.4× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot {\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2} \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (* t_s (pow (/ (* l (sqrt 2.0)) (* k (* k (sqrt t_m)))) 2.0)))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	return t_s * pow(((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))), 2.0);
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = t_s * (((l * sqrt(2.0d0)) / (k * (k * sqrt(t_m)))) ** 2.0d0)
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	return t_s * Math.pow(((l * Math.sqrt(2.0)) / (k * (k * Math.sqrt(t_m)))), 2.0);
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	return t_s * math.pow(((l * math.sqrt(2.0)) / (k * (k * math.sqrt(t_m)))), 2.0)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	return Float64(t_s * (Float64(Float64(l * sqrt(2.0)) / Float64(k * Float64(k * sqrt(t_m)))) ^ 2.0))
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k)
	tmp = t_s * (((l * sqrt(2.0)) / (k * (k * sqrt(t_m)))) ^ 2.0);
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[Power[N[(N[(l * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot {\left(\frac{\ell \cdot \sqrt{2}}{k \cdot \left(k \cdot \sqrt{t\_m}\right)}\right)}^{2}
\end{array}
Derivation
  1. Initial program 37.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. Simplified43.6%

    \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. add-sqr-sqrt31.8%

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

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)}\right)}^{2}} \]
  5. Applied egg-rr34.0%

    \[\leadsto \color{blue}{{\left(\ell \cdot \frac{\sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}^{2}} \]
  6. Step-by-step derivation
    1. associate-*r/33.9%

      \[\leadsto {\color{blue}{\left(\frac{\ell \cdot \sqrt{2}}{\left(\sqrt{\sin k \cdot \tan k} \cdot \frac{k}{t}\right) \cdot {t}^{1.5}}\right)}}^{2} \]
    2. associate-*l*35.2%

      \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{\sqrt{\sin k \cdot \tan k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}}\right)}^{2} \]
  7. Applied egg-rr35.2%

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

    \[\leadsto {\left(\frac{\ell \cdot \sqrt{2}}{\color{blue}{k} \cdot \left(\frac{k}{t} \cdot {t}^{1.5}\right)}\right)}^{2} \]
  9. Taylor expanded in k around 0 44.3%

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

Alternative 9: 64.9% accurate, 3.8× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\left(\ell \cdot \frac{\ell}{t\_m}\right) \cdot \frac{2}{{k}^{4}}\right) \end{array} \]
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
 :precision binary64
 (* t_s (* (* l (/ l t_m)) (/ 2.0 (pow k 4.0)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
	return t_s * ((l * (l / t_m)) * (2.0 / pow(k, 4.0)));
}
t\_m = abs(t)
t\_s = copysign(1.0d0, t)
real(8) function code(t_s, t_m, l, k)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    code = t_s * ((l * (l / t_m)) * (2.0d0 / (k ** 4.0d0)))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
	return t_s * ((l * (l / t_m)) * (2.0 / Math.pow(k, 4.0)));
}
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, t_m, l, k):
	return t_s * ((l * (l / t_m)) * (2.0 / math.pow(k, 4.0)))
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, t_m, l, k)
	return Float64(t_s * Float64(Float64(l * Float64(l / t_m)) * Float64(2.0 / (k ^ 4.0))))
end
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp = code(t_s, t_m, l, k)
	tmp = t_s * ((l * (l / t_m)) * (2.0 / (k ^ 4.0)));
end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(l * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \left(\left(\ell \cdot \frac{\ell}{t\_m}\right) \cdot \frac{2}{{k}^{4}}\right)
\end{array}
Derivation
  1. Initial program 37.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. Simplified43.6%

    \[\leadsto \color{blue}{\frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot {\left(\frac{k}{t}\right)}^{2}\right)\right)} \cdot \left(\ell \cdot \ell\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in k around 0 62.7%

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

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

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

      \[\leadsto \frac{{\ell}^{2} \cdot 2}{\color{blue}{t \cdot {k}^{4}}} \]
    4. times-frac62.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{2}}{t} \cdot \frac{2}{{k}^{4}}} \]
  6. Simplified62.5%

    \[\leadsto \color{blue}{\frac{{\ell}^{2}}{t} \cdot \frac{2}{{k}^{4}}} \]
  7. Step-by-step derivation
    1. pow262.5%

      \[\leadsto \frac{\color{blue}{\ell \cdot \ell}}{t} \cdot \frac{2}{{k}^{4}} \]
  8. Applied egg-rr62.5%

    \[\leadsto \frac{\color{blue}{\ell \cdot \ell}}{t} \cdot \frac{2}{{k}^{4}} \]
  9. Step-by-step derivation
    1. associate-/l*67.2%

      \[\leadsto \color{blue}{\left(\ell \cdot \frac{\ell}{t}\right)} \cdot \frac{2}{{k}^{4}} \]
  10. Applied egg-rr67.2%

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

Reproduce

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