Toniolo and Linder, Equation (10+)

Percentage Accurate: 54.8% → 90.4%
Time: 17.7s
Alternatives: 21
Speedup: 12.5×

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 21 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: 54.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \end{array} \]
(FPCore (t l k)
 :precision binary64
 (/
  2.0
  (*
   (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
   (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
	return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
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: 90.4% accurate, 1.2× speedup?

\[\begin{array}{l} t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := \frac{\sin k}{\ell}\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 1.95 \cdot 10^{+109}:\\ \;\;\;\;\frac{2}{\frac{\tan k}{\ell} \cdot \left(t\_m \cdot \mathsf{fma}\left(t\_2, 2 \cdot \left(t\_m \cdot t\_m\right), k \cdot \left(k \cdot t\_2\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\tan k \cdot \left(t\_m \cdot \left(\left(t\_m \cdot t\_2\right) \cdot \frac{t\_m}{\ell}\right)\right)\right) \cdot \left(1 + \left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right)\right)}\\ \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 (/ (sin k) l)))
   (*
    t_s
    (if (<= t_m 1.95e+109)
      (/
       2.0
       (* (/ (tan k) l) (* t_m (fma t_2 (* 2.0 (* t_m t_m)) (* k (* k t_2))))))
      (/
       2.0
       (*
        (* (tan k) (* t_m (* (* t_m t_2) (/ t_m l))))
        (+ 1.0 (+ 1.0 (pow (/ 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 = sin(k) / l;
	double tmp;
	if (t_m <= 1.95e+109) {
		tmp = 2.0 / ((tan(k) / l) * (t_m * fma(t_2, (2.0 * (t_m * t_m)), (k * (k * t_2)))));
	} else {
		tmp = 2.0 / ((tan(k) * (t_m * ((t_m * t_2) * (t_m / l)))) * (1.0 + (1.0 + pow((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(sin(k) / l)
	tmp = 0.0
	if (t_m <= 1.95e+109)
		tmp = Float64(2.0 / Float64(Float64(tan(k) / l) * Float64(t_m * fma(t_2, Float64(2.0 * Float64(t_m * t_m)), Float64(k * Float64(k * t_2))))));
	else
		tmp = Float64(2.0 / Float64(Float64(tan(k) * Float64(t_m * Float64(Float64(t_m * t_2) * Float64(t_m / l)))) * Float64(1.0 + Float64(1.0 + (Float64(k / t_m) ^ 2.0)))));
	end
	return Float64(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[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.95e+109], N[(2.0 / N[(N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision] * N[(t$95$m * N[(t$95$2 * N[(2.0 * N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision] + N[(k * N[(k * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[Tan[k], $MachinePrecision] * N[(t$95$m * N[(N[(t$95$m * t$95$2), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := \frac{\sin k}{\ell}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.95 \cdot 10^{+109}:\\
\;\;\;\;\frac{2}{\frac{\tan k}{\ell} \cdot \left(t\_m \cdot \mathsf{fma}\left(t\_2, 2 \cdot \left(t\_m \cdot t\_m\right), k \cdot \left(k \cdot t\_2\right)\right)\right)}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{t \cdot \left(\color{blue}{\left(\frac{\sin k}{\ell \cdot \cos k} \cdot \frac{\sin k}{\ell}\right)} \cdot \mathsf{fma}\left(k, k, 2 \cdot \left(t \cdot t\right)\right)\right)} \]
      9. lower-/.f6481.8

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{\left(\left(\frac{\sin k}{\ell \cdot \cos k} \cdot \frac{\sin k}{\ell}\right) \cdot \mathsf{fma}\left(k, k, 2 \cdot \left(t \cdot t\right)\right)\right) \cdot t}} \]
    9. Applied egg-rr87.7%

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

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

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

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

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

        \[\leadsto \frac{2}{\frac{\tan k}{\ell} \cdot \left(\left(\frac{\sin k}{\ell} \cdot \left(\color{blue}{2 \cdot \left(t \cdot t\right)} + k \cdot k\right)\right) \cdot t\right)} \]
      6. distribute-lft-inN/A

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

        \[\leadsto \frac{2}{\frac{\tan k}{\ell} \cdot \left(\color{blue}{\mathsf{fma}\left(\frac{\sin k}{\ell}, 2 \cdot \left(t \cdot t\right), \frac{\sin k}{\ell} \cdot \left(k \cdot k\right)\right)} \cdot t\right)} \]
      8. *-commutativeN/A

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

        \[\leadsto \frac{2}{\frac{\tan k}{\ell} \cdot \left(\mathsf{fma}\left(\frac{\sin k}{\ell}, 2 \cdot \left(t \cdot t\right), \color{blue}{\left(k \cdot k\right)} \cdot \frac{\sin k}{\ell}\right) \cdot t\right)} \]
      10. associate-*l*N/A

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

        \[\leadsto \frac{2}{\frac{\tan k}{\ell} \cdot \left(\mathsf{fma}\left(\frac{\sin k}{\ell}, 2 \cdot \left(t \cdot t\right), \color{blue}{k \cdot \left(k \cdot \frac{\sin k}{\ell}\right)}\right) \cdot t\right)} \]
      12. lower-*.f6494.2

        \[\leadsto \frac{2}{\frac{\tan k}{\ell} \cdot \left(\mathsf{fma}\left(\frac{\sin k}{\ell}, 2 \cdot \left(t \cdot t\right), k \cdot \color{blue}{\left(k \cdot \frac{\sin k}{\ell}\right)}\right) \cdot t\right)} \]
    11. Applied egg-rr94.2%

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

    if 1.95000000000000008e109 < t

    1. Initial program 67.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. Step-by-step derivation
      1. lift-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(t \cdot \left(\frac{\color{blue}{t \cdot t}}{\ell} \cdot \frac{\sin k}{\ell}\right)\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
      15. lower-/.f6479.0

        \[\leadsto \frac{2}{\left(\left(t \cdot \left(\frac{t \cdot t}{\ell} \cdot \color{blue}{\frac{\sin k}{\ell}}\right)\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    4. Applied egg-rr79.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{\left(\left(t \cdot \color{blue}{\left(\left(\frac{\sin k}{\ell} \cdot t\right) \cdot \frac{t}{\ell}\right)}\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
      12. lower-*.f6495.4

        \[\leadsto \frac{2}{\left(\left(t \cdot \left(\color{blue}{\left(\frac{\sin k}{\ell} \cdot t\right)} \cdot \frac{t}{\ell}\right)\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)} \]
    6. Applied egg-rr95.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.95 \cdot 10^{+109}:\\ \;\;\;\;\frac{2}{\frac{\tan k}{\ell} \cdot \left(t \cdot \mathsf{fma}\left(\frac{\sin k}{\ell}, 2 \cdot \left(t \cdot t\right), k \cdot \left(k \cdot \frac{\sin k}{\ell}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\left(\tan k \cdot \left(t \cdot \left(\left(t \cdot \frac{\sin k}{\ell}\right) \cdot \frac{t}{\ell}\right)\right)\right) \cdot \left(1 + \left(1 + {\left(\frac{k}{t}\right)}^{2}\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 69.1% accurate, 0.9× 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}\;\frac{2}{\left(1 + \left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right)\right) \cdot \left(\tan k \cdot \left(\sin k \cdot \frac{{t\_m}^{3}}{\ell \cdot \ell}\right)\right)} \leq \infty:\\ \;\;\;\;\frac{\ell}{t\_m \cdot k} \cdot \frac{\ell}{k \cdot \left(t\_m \cdot t\_m\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m \cdot \left(t\_m \cdot \left(k \cdot k\right)\right)}\\ \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 (<=
       (/
        2.0
        (*
         (+ 1.0 (+ 1.0 (pow (/ k t_m) 2.0)))
         (* (tan k) (* (sin k) (/ (pow t_m 3.0) (* l l))))))
       INFINITY)
    (* (/ l (* t_m k)) (/ l (* k (* t_m t_m))))
    (* (/ l t_m) (/ l (* t_m (* t_m (* k 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 ((2.0 / ((1.0 + (1.0 + pow((k / t_m), 2.0))) * (tan(k) * (sin(k) * (pow(t_m, 3.0) / (l * l)))))) <= ((double) INFINITY)) {
		tmp = (l / (t_m * k)) * (l / (k * (t_m * t_m)));
	} else {
		tmp = (l / t_m) * (l / (t_m * (t_m * (k * k))));
	}
	return t_s * tmp;
}
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 ((2.0 / ((1.0 + (1.0 + Math.pow((k / t_m), 2.0))) * (Math.tan(k) * (Math.sin(k) * (Math.pow(t_m, 3.0) / (l * l)))))) <= Double.POSITIVE_INFINITY) {
		tmp = (l / (t_m * k)) * (l / (k * (t_m * t_m)));
	} else {
		tmp = (l / t_m) * (l / (t_m * (t_m * (k * 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 (2.0 / ((1.0 + (1.0 + math.pow((k / t_m), 2.0))) * (math.tan(k) * (math.sin(k) * (math.pow(t_m, 3.0) / (l * l)))))) <= math.inf:
		tmp = (l / (t_m * k)) * (l / (k * (t_m * t_m)))
	else:
		tmp = (l / t_m) * (l / (t_m * (t_m * (k * 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 (Float64(2.0 / Float64(Float64(1.0 + Float64(1.0 + (Float64(k / t_m) ^ 2.0))) * Float64(tan(k) * Float64(sin(k) * Float64((t_m ^ 3.0) / Float64(l * l)))))) <= Inf)
		tmp = Float64(Float64(l / Float64(t_m * k)) * Float64(l / Float64(k * Float64(t_m * t_m))));
	else
		tmp = Float64(Float64(l / t_m) * Float64(l / Float64(t_m * Float64(t_m * Float64(k * 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 ((2.0 / ((1.0 + (1.0 + ((k / t_m) ^ 2.0))) * (tan(k) * (sin(k) * ((t_m ^ 3.0) / (l * l)))))) <= Inf)
		tmp = (l / (t_m * k)) * (l / (k * (t_m * t_m)));
	else
		tmp = (l / t_m) * (l / (t_m * (t_m * (k * 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[N[(2.0 / N[(N[(1.0 + N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(l / N[(t$95$m * k), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / t$95$m), $MachinePrecision] * N[(l / N[(t$95$m * N[(t$95$m * N[(k * 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}\;\frac{2}{\left(1 + \left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right)\right) \cdot \left(\tan k \cdot \left(\sin k \cdot \frac{{t\_m}^{3}}{\ell \cdot \ell}\right)\right)} \leq \infty:\\
\;\;\;\;\frac{\ell}{t\_m \cdot k} \cdot \frac{\ell}{k \cdot \left(t\_m \cdot t\_m\right)}\\

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


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

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(t \cdot \left(t \cdot t\right)\right) \cdot \color{blue}{\left(k \cdot k\right)}} \]
      12. lower-*.f6471.7

        \[\leadsto \frac{\ell \cdot \ell}{\left(t \cdot \left(t \cdot t\right)\right) \cdot \color{blue}{\left(k \cdot k\right)}} \]
    5. Simplified71.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\ell}{\left(t \cdot \left(t \cdot t\right)\right) \cdot \left(k \cdot k\right)} \cdot \ell} \]
      8. lower-/.f6472.4

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

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

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

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

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

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

        \[\leadsto \frac{\ell}{k \cdot \color{blue}{\left(k \cdot \left(t \cdot \left(t \cdot t\right)\right)\right)}} \cdot \ell \]
      15. lower-*.f6478.0

        \[\leadsto \frac{\ell}{k \cdot \color{blue}{\left(k \cdot \left(t \cdot \left(t \cdot t\right)\right)\right)}} \cdot \ell \]
    7. Applied egg-rr78.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell}{\color{blue}{\left(k \cdot t\right) \cdot \left(k \cdot \left(t \cdot t\right)\right)}} \cdot \ell \]
      11. lower-*.f6480.6

        \[\leadsto \frac{\ell}{\color{blue}{\left(k \cdot t\right)} \cdot \left(k \cdot \left(t \cdot t\right)\right)} \cdot \ell \]
    9. Applied egg-rr80.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{\left(k \cdot \left(t \cdot t\right)\right) \cdot \left(k \cdot t\right)}} \]
      8. times-fracN/A

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

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

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

        \[\leadsto \frac{\ell}{k \cdot \left(t \cdot t\right)} \cdot \color{blue}{\frac{\ell}{k \cdot t}} \]
    11. Applied egg-rr83.6%

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

    if +inf.0 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))))

    1. Initial program 0.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}{\frac{{\ell}^{2}}{{k}^{2} \cdot {t}^{3}}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{\left(t \cdot \left(t \cdot t\right)\right) \cdot \color{blue}{\left(k \cdot k\right)}} \]
      12. lower-*.f6410.4

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

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

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

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

        \[\leadsto \frac{\ell \cdot \ell}{\color{blue}{t \cdot \left(\left(t \cdot t\right) \cdot \left(k \cdot k\right)\right)}} \]
      4. times-fracN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\ell}{t} \cdot \frac{\ell}{t \cdot \color{blue}{\left(t \cdot \left(k \cdot k\right)\right)}} \]
      13. lower-*.f6440.1

        \[\leadsto \frac{\ell}{t} \cdot \frac{\ell}{t \cdot \color{blue}{\left(t \cdot \left(k \cdot k\right)\right)}} \]
    7. Applied egg-rr40.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{2}{\left(1 + \left(1 + {\left(\frac{k}{t}\right)}^{2}\right)\right) \cdot \left(\tan k \cdot \left(\sin k \cdot \frac{{t}^{3}}{\ell \cdot \ell}\right)\right)} \leq \infty:\\ \;\;\;\;\frac{\ell}{t \cdot k} \cdot \frac{\ell}{k \cdot \left(t \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{t} \cdot \frac{\ell}{t \cdot \left(t \cdot \left(k \cdot k\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Reproduce

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