VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.4% → 81.9%
Time: 11.7s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \end{array} \]
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
double code(double F, double l) {
	return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
public static double code(double F, double l) {
	return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
def code(F, l):
	return (math.pi * l) - ((1.0 / (F * F)) * math.tan((math.pi * l)))
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l))))
end
function tmp = code(F, l)
	tmp = (pi * l) - ((1.0 / (F * F)) * tan((pi * l)));
end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\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 6 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: 76.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \end{array} \]
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
double code(double F, double l) {
	return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
public static double code(double F, double l) {
	return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
def code(F, l):
	return (math.pi * l) - ((1.0 / (F * F)) * math.tan((math.pi * l)))
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l))))
end
function tmp = code(F, l)
	tmp = (pi * l) - ((1.0 / (F * F)) * tan((pi * l)));
end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\end{array}

Alternative 1: 81.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan \left(\pi \cdot \ell\right)\\ t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\ \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)}{F \cdot F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (tan (* PI l))) (t_1 (- (* PI l) (/ (* F F) t_0))))
   (if (<= (* PI l) -2e+22)
     t_1
     (if (<= (* PI l) 7.5e+194)
       (- (* PI l) (/ (/ t_0 F) F))
       (if (<= (* PI l) 2e+226)
         t_1
         (- (* PI l) (/ (tan (expm1 (log1p (* PI l)))) (* F F))))))))
double code(double F, double l) {
	double t_0 = tan((((double) M_PI) * l));
	double t_1 = (((double) M_PI) * l) - ((F * F) / t_0);
	double tmp;
	if ((((double) M_PI) * l) <= -2e+22) {
		tmp = t_1;
	} else if ((((double) M_PI) * l) <= 7.5e+194) {
		tmp = (((double) M_PI) * l) - ((t_0 / F) / F);
	} else if ((((double) M_PI) * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (((double) M_PI) * l) - (tan(expm1(log1p((((double) M_PI) * l)))) / (F * F));
	}
	return tmp;
}
public static double code(double F, double l) {
	double t_0 = Math.tan((Math.PI * l));
	double t_1 = (Math.PI * l) - ((F * F) / t_0);
	double tmp;
	if ((Math.PI * l) <= -2e+22) {
		tmp = t_1;
	} else if ((Math.PI * l) <= 7.5e+194) {
		tmp = (Math.PI * l) - ((t_0 / F) / F);
	} else if ((Math.PI * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (Math.PI * l) - (Math.tan(Math.expm1(Math.log1p((Math.PI * l)))) / (F * F));
	}
	return tmp;
}
def code(F, l):
	t_0 = math.tan((math.pi * l))
	t_1 = (math.pi * l) - ((F * F) / t_0)
	tmp = 0
	if (math.pi * l) <= -2e+22:
		tmp = t_1
	elif (math.pi * l) <= 7.5e+194:
		tmp = (math.pi * l) - ((t_0 / F) / F)
	elif (math.pi * l) <= 2e+226:
		tmp = t_1
	else:
		tmp = (math.pi * l) - (math.tan(math.expm1(math.log1p((math.pi * l)))) / (F * F))
	return tmp
function code(F, l)
	t_0 = tan(Float64(pi * l))
	t_1 = Float64(Float64(pi * l) - Float64(Float64(F * F) / t_0))
	tmp = 0.0
	if (Float64(pi * l) <= -2e+22)
		tmp = t_1;
	elseif (Float64(pi * l) <= 7.5e+194)
		tmp = Float64(Float64(pi * l) - Float64(Float64(t_0 / F) / F));
	elseif (Float64(pi * l) <= 2e+226)
		tmp = t_1;
	else
		tmp = Float64(Float64(pi * l) - Float64(tan(expm1(log1p(Float64(pi * l)))) / Float64(F * F)));
	end
	return tmp
end
code[F_, l_] := Block[{t$95$0 = N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * l), $MachinePrecision] - N[(N[(F * F), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(Pi * l), $MachinePrecision], -2e+22], t$95$1, If[LessEqual[N[(Pi * l), $MachinePrecision], 7.5e+194], N[(N[(Pi * l), $MachinePrecision] - N[(N[(t$95$0 / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], 2e+226], t$95$1, N[(N[(Pi * l), $MachinePrecision] - N[(N[Tan[N[(Exp[N[Log[1 + N[(Pi * l), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan \left(\pi \cdot \ell\right)\\
t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)}{F \cdot F}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -2e22 or 7.5000000000000002e194 < (*.f64 (PI.f64) l) < 1.99999999999999992e226

    1. Initial program 49.2%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(F \cdot F\right)}^{-1}} \cdot \tan \left(\pi \cdot \ell\right) \]
      2. unpow-prod-down49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left({F}^{-1} \cdot {F}^{-1}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      3. pow-prod-up49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{F}^{\left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      4. add-sqr-sqrt14.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      5. pow214.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left({\left(\sqrt{F}\right)}^{2}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      6. pow-pow14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{\left(2 \cdot \left(-1 + -1\right)\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      7. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\left(2 \cdot \color{blue}{-2}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      8. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\color{blue}{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Applied egg-rr14.8%

      \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    4. Step-by-step derivation
      1. *-commutative14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot {\left(\sqrt{F}\right)}^{-4}} \]
      2. sqrt-pow249.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{{F}^{\left(\frac{-4}{2}\right)}} \]
      3. sqr-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\left({F}^{\left(\frac{\frac{-4}{2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right)} \]
      4. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\left(\frac{\color{blue}{-2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      5. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\color{blue}{-1}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      6. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\color{blue}{\frac{1}{F}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      7. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\left(\frac{\color{blue}{-2}}{2}\right)}\right) \]
      8. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\color{blue}{-1}}\right) \]
      9. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot \color{blue}{\frac{1}{F}}\right) \]
      10. associate-*r*49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left(\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}\right) \cdot \frac{1}{F}} \]
      11. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}} \cdot \frac{1}{F} \]
      12. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      13. clear-num49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}} \]
      14. unpow-149.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right)}^{-1}} \]
      15. exp-to-pow25.3%

        \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}} \]
      16. add-sqr-sqrt10.9%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1} \cdot \sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}}} \]
      17. sqrt-unprod16.3%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right) \cdot \left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right)}}} \]
    5. Applied egg-rr76.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}} \]

    if -2e22 < (*.f64 (PI.f64) l) < 7.5000000000000002e194

    1. Initial program 87.0%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/87.7%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-un-lft-identity87.7%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
      3. associate-/r*94.1%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    3. Applied egg-rr94.1%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]

    if 1.99999999999999992e226 < (*.f64 (PI.f64) l)

    1. Initial program 75.8%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/75.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-lft-identity75.8%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
    3. Simplified75.8%

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
    4. Step-by-step derivation
      1. expm1-log1p-u76.8%

        \[\leadsto \pi \cdot \ell - \frac{\tan \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)}}{F \cdot F} \]
    5. Applied egg-rr76.8%

      \[\leadsto \pi \cdot \ell - \frac{\tan \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)}}{F \cdot F} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)}{F \cdot F}\\ \end{array} \]

Alternative 2: 79.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan \left(\pi \cdot \ell\right)\\ t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\ \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - t_0 \cdot e^{\log F \cdot -2}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (tan (* PI l))) (t_1 (- (* PI l) (/ (* F F) t_0))))
   (if (<= (* PI l) -2e+22)
     t_1
     (if (<= (* PI l) 7.5e+194)
       (- (* PI l) (/ (/ t_0 F) F))
       (if (<= (* PI l) 2e+226)
         t_1
         (- (* PI l) (* t_0 (exp (* (log F) -2.0)))))))))
double code(double F, double l) {
	double t_0 = tan((((double) M_PI) * l));
	double t_1 = (((double) M_PI) * l) - ((F * F) / t_0);
	double tmp;
	if ((((double) M_PI) * l) <= -2e+22) {
		tmp = t_1;
	} else if ((((double) M_PI) * l) <= 7.5e+194) {
		tmp = (((double) M_PI) * l) - ((t_0 / F) / F);
	} else if ((((double) M_PI) * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (((double) M_PI) * l) - (t_0 * exp((log(F) * -2.0)));
	}
	return tmp;
}
public static double code(double F, double l) {
	double t_0 = Math.tan((Math.PI * l));
	double t_1 = (Math.PI * l) - ((F * F) / t_0);
	double tmp;
	if ((Math.PI * l) <= -2e+22) {
		tmp = t_1;
	} else if ((Math.PI * l) <= 7.5e+194) {
		tmp = (Math.PI * l) - ((t_0 / F) / F);
	} else if ((Math.PI * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (Math.PI * l) - (t_0 * Math.exp((Math.log(F) * -2.0)));
	}
	return tmp;
}
def code(F, l):
	t_0 = math.tan((math.pi * l))
	t_1 = (math.pi * l) - ((F * F) / t_0)
	tmp = 0
	if (math.pi * l) <= -2e+22:
		tmp = t_1
	elif (math.pi * l) <= 7.5e+194:
		tmp = (math.pi * l) - ((t_0 / F) / F)
	elif (math.pi * l) <= 2e+226:
		tmp = t_1
	else:
		tmp = (math.pi * l) - (t_0 * math.exp((math.log(F) * -2.0)))
	return tmp
function code(F, l)
	t_0 = tan(Float64(pi * l))
	t_1 = Float64(Float64(pi * l) - Float64(Float64(F * F) / t_0))
	tmp = 0.0
	if (Float64(pi * l) <= -2e+22)
		tmp = t_1;
	elseif (Float64(pi * l) <= 7.5e+194)
		tmp = Float64(Float64(pi * l) - Float64(Float64(t_0 / F) / F));
	elseif (Float64(pi * l) <= 2e+226)
		tmp = t_1;
	else
		tmp = Float64(Float64(pi * l) - Float64(t_0 * exp(Float64(log(F) * -2.0))));
	end
	return tmp
end
function tmp_2 = code(F, l)
	t_0 = tan((pi * l));
	t_1 = (pi * l) - ((F * F) / t_0);
	tmp = 0.0;
	if ((pi * l) <= -2e+22)
		tmp = t_1;
	elseif ((pi * l) <= 7.5e+194)
		tmp = (pi * l) - ((t_0 / F) / F);
	elseif ((pi * l) <= 2e+226)
		tmp = t_1;
	else
		tmp = (pi * l) - (t_0 * exp((log(F) * -2.0)));
	end
	tmp_2 = tmp;
end
code[F_, l_] := Block[{t$95$0 = N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * l), $MachinePrecision] - N[(N[(F * F), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(Pi * l), $MachinePrecision], -2e+22], t$95$1, If[LessEqual[N[(Pi * l), $MachinePrecision], 7.5e+194], N[(N[(Pi * l), $MachinePrecision] - N[(N[(t$95$0 / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], 2e+226], t$95$1, N[(N[(Pi * l), $MachinePrecision] - N[(t$95$0 * N[Exp[N[(N[Log[F], $MachinePrecision] * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan \left(\pi \cdot \ell\right)\\
t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - t_0 \cdot e^{\log F \cdot -2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -2e22 or 7.5000000000000002e194 < (*.f64 (PI.f64) l) < 1.99999999999999992e226

    1. Initial program 49.2%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(F \cdot F\right)}^{-1}} \cdot \tan \left(\pi \cdot \ell\right) \]
      2. unpow-prod-down49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left({F}^{-1} \cdot {F}^{-1}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      3. pow-prod-up49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{F}^{\left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      4. add-sqr-sqrt14.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      5. pow214.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left({\left(\sqrt{F}\right)}^{2}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      6. pow-pow14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{\left(2 \cdot \left(-1 + -1\right)\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      7. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\left(2 \cdot \color{blue}{-2}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      8. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\color{blue}{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Applied egg-rr14.8%

      \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    4. Step-by-step derivation
      1. *-commutative14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot {\left(\sqrt{F}\right)}^{-4}} \]
      2. sqrt-pow249.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{{F}^{\left(\frac{-4}{2}\right)}} \]
      3. sqr-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\left({F}^{\left(\frac{\frac{-4}{2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right)} \]
      4. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\left(\frac{\color{blue}{-2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      5. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\color{blue}{-1}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      6. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\color{blue}{\frac{1}{F}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      7. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\left(\frac{\color{blue}{-2}}{2}\right)}\right) \]
      8. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\color{blue}{-1}}\right) \]
      9. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot \color{blue}{\frac{1}{F}}\right) \]
      10. associate-*r*49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left(\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}\right) \cdot \frac{1}{F}} \]
      11. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}} \cdot \frac{1}{F} \]
      12. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      13. clear-num49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}} \]
      14. unpow-149.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right)}^{-1}} \]
      15. exp-to-pow25.3%

        \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}} \]
      16. add-sqr-sqrt10.9%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1} \cdot \sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}}} \]
      17. sqrt-unprod16.3%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right) \cdot \left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right)}}} \]
    5. Applied egg-rr76.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}} \]

    if -2e22 < (*.f64 (PI.f64) l) < 7.5000000000000002e194

    1. Initial program 87.0%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/87.7%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-un-lft-identity87.7%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
      3. associate-/r*94.1%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    3. Applied egg-rr94.1%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]

    if 1.99999999999999992e226 < (*.f64 (PI.f64) l)

    1. Initial program 75.8%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. inv-pow75.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(F \cdot F\right)}^{-1}} \cdot \tan \left(\pi \cdot \ell\right) \]
      2. unpow-prod-down75.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left({F}^{-1} \cdot {F}^{-1}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      3. pow-prod-up75.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{F}^{\left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      4. pow-to-exp32.1%

        \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log F \cdot \left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      5. metadata-eval32.1%

        \[\leadsto \pi \cdot \ell - e^{\log F \cdot \color{blue}{-2}} \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Applied egg-rr32.1%

      \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log F \cdot -2}} \cdot \tan \left(\pi \cdot \ell\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot e^{\log F \cdot -2}\\ \end{array} \]

Alternative 3: 81.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan \left(\pi \cdot \ell\right)\\ t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\ \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-88}:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{+226}\right):\\ \;\;\;\;\pi \cdot \ell - \frac{t_0}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (tan (* PI l))) (t_1 (- (* PI l) (/ (* F F) t_0))))
   (if (<= (* PI l) -2e+22)
     t_1
     (if (<= (* PI l) 5e-88)
       (- (* PI l) (* (/ l F) (/ PI F)))
       (if (or (<= (* PI l) 7.5e+194) (not (<= (* PI l) 2e+226)))
         (- (* PI l) (/ t_0 (* F F)))
         t_1)))))
double code(double F, double l) {
	double t_0 = tan((((double) M_PI) * l));
	double t_1 = (((double) M_PI) * l) - ((F * F) / t_0);
	double tmp;
	if ((((double) M_PI) * l) <= -2e+22) {
		tmp = t_1;
	} else if ((((double) M_PI) * l) <= 5e-88) {
		tmp = (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
	} else if (((((double) M_PI) * l) <= 7.5e+194) || !((((double) M_PI) * l) <= 2e+226)) {
		tmp = (((double) M_PI) * l) - (t_0 / (F * F));
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double F, double l) {
	double t_0 = Math.tan((Math.PI * l));
	double t_1 = (Math.PI * l) - ((F * F) / t_0);
	double tmp;
	if ((Math.PI * l) <= -2e+22) {
		tmp = t_1;
	} else if ((Math.PI * l) <= 5e-88) {
		tmp = (Math.PI * l) - ((l / F) * (Math.PI / F));
	} else if (((Math.PI * l) <= 7.5e+194) || !((Math.PI * l) <= 2e+226)) {
		tmp = (Math.PI * l) - (t_0 / (F * F));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(F, l):
	t_0 = math.tan((math.pi * l))
	t_1 = (math.pi * l) - ((F * F) / t_0)
	tmp = 0
	if (math.pi * l) <= -2e+22:
		tmp = t_1
	elif (math.pi * l) <= 5e-88:
		tmp = (math.pi * l) - ((l / F) * (math.pi / F))
	elif ((math.pi * l) <= 7.5e+194) or not ((math.pi * l) <= 2e+226):
		tmp = (math.pi * l) - (t_0 / (F * F))
	else:
		tmp = t_1
	return tmp
function code(F, l)
	t_0 = tan(Float64(pi * l))
	t_1 = Float64(Float64(pi * l) - Float64(Float64(F * F) / t_0))
	tmp = 0.0
	if (Float64(pi * l) <= -2e+22)
		tmp = t_1;
	elseif (Float64(pi * l) <= 5e-88)
		tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F)));
	elseif ((Float64(pi * l) <= 7.5e+194) || !(Float64(pi * l) <= 2e+226))
		tmp = Float64(Float64(pi * l) - Float64(t_0 / Float64(F * F)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(F, l)
	t_0 = tan((pi * l));
	t_1 = (pi * l) - ((F * F) / t_0);
	tmp = 0.0;
	if ((pi * l) <= -2e+22)
		tmp = t_1;
	elseif ((pi * l) <= 5e-88)
		tmp = (pi * l) - ((l / F) * (pi / F));
	elseif (((pi * l) <= 7.5e+194) || ~(((pi * l) <= 2e+226)))
		tmp = (pi * l) - (t_0 / (F * F));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[F_, l_] := Block[{t$95$0 = N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * l), $MachinePrecision] - N[(N[(F * F), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(Pi * l), $MachinePrecision], -2e+22], t$95$1, If[LessEqual[N[(Pi * l), $MachinePrecision], 5e-88], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(Pi * l), $MachinePrecision], 7.5e+194], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 2e+226]], $MachinePrecision]], N[(N[(Pi * l), $MachinePrecision] - N[(t$95$0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan \left(\pi \cdot \ell\right)\\
t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-88}:\\
\;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{+226}\right):\\
\;\;\;\;\pi \cdot \ell - \frac{t_0}{F \cdot F}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -2e22 or 7.5000000000000002e194 < (*.f64 (PI.f64) l) < 1.99999999999999992e226

    1. Initial program 49.2%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(F \cdot F\right)}^{-1}} \cdot \tan \left(\pi \cdot \ell\right) \]
      2. unpow-prod-down49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left({F}^{-1} \cdot {F}^{-1}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      3. pow-prod-up49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{F}^{\left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      4. add-sqr-sqrt14.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      5. pow214.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left({\left(\sqrt{F}\right)}^{2}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      6. pow-pow14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{\left(2 \cdot \left(-1 + -1\right)\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      7. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\left(2 \cdot \color{blue}{-2}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      8. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\color{blue}{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Applied egg-rr14.8%

      \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    4. Step-by-step derivation
      1. *-commutative14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot {\left(\sqrt{F}\right)}^{-4}} \]
      2. sqrt-pow249.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{{F}^{\left(\frac{-4}{2}\right)}} \]
      3. sqr-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\left({F}^{\left(\frac{\frac{-4}{2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right)} \]
      4. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\left(\frac{\color{blue}{-2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      5. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\color{blue}{-1}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      6. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\color{blue}{\frac{1}{F}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      7. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\left(\frac{\color{blue}{-2}}{2}\right)}\right) \]
      8. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\color{blue}{-1}}\right) \]
      9. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot \color{blue}{\frac{1}{F}}\right) \]
      10. associate-*r*49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left(\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}\right) \cdot \frac{1}{F}} \]
      11. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}} \cdot \frac{1}{F} \]
      12. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      13. clear-num49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}} \]
      14. unpow-149.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right)}^{-1}} \]
      15. exp-to-pow25.3%

        \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}} \]
      16. add-sqr-sqrt10.9%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1} \cdot \sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}}} \]
      17. sqrt-unprod16.3%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right) \cdot \left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right)}}} \]
    5. Applied egg-rr76.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}} \]

    if -2e22 < (*.f64 (PI.f64) l) < 5.00000000000000009e-88

    1. Initial program 88.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Taylor expanded in l around 0 89.7%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell \cdot \pi}{{F}^{2}}} \]
    3. Step-by-step derivation
      1. unpow289.7%

        \[\leadsto \pi \cdot \ell - \frac{\ell \cdot \pi}{\color{blue}{F \cdot F}} \]
      2. times-frac99.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]
    4. Simplified99.6%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]

    if 5.00000000000000009e-88 < (*.f64 (PI.f64) l) < 7.5000000000000002e194 or 1.99999999999999992e226 < (*.f64 (PI.f64) l)

    1. Initial program 82.1%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/82.1%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-lft-identity82.1%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
    3. Simplified82.1%

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-88}:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{+226}\right):\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \end{array} \]

Alternative 4: 81.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan \left(\pi \cdot \ell\right)\\ t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\ \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{t_0}{F \cdot F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (tan (* PI l))) (t_1 (- (* PI l) (/ (* F F) t_0))))
   (if (<= (* PI l) -2e+22)
     t_1
     (if (<= (* PI l) 7.5e+194)
       (- (* PI l) (/ (/ t_0 F) F))
       (if (<= (* PI l) 2e+226) t_1 (- (* PI l) (/ t_0 (* F F))))))))
double code(double F, double l) {
	double t_0 = tan((((double) M_PI) * l));
	double t_1 = (((double) M_PI) * l) - ((F * F) / t_0);
	double tmp;
	if ((((double) M_PI) * l) <= -2e+22) {
		tmp = t_1;
	} else if ((((double) M_PI) * l) <= 7.5e+194) {
		tmp = (((double) M_PI) * l) - ((t_0 / F) / F);
	} else if ((((double) M_PI) * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (((double) M_PI) * l) - (t_0 / (F * F));
	}
	return tmp;
}
public static double code(double F, double l) {
	double t_0 = Math.tan((Math.PI * l));
	double t_1 = (Math.PI * l) - ((F * F) / t_0);
	double tmp;
	if ((Math.PI * l) <= -2e+22) {
		tmp = t_1;
	} else if ((Math.PI * l) <= 7.5e+194) {
		tmp = (Math.PI * l) - ((t_0 / F) / F);
	} else if ((Math.PI * l) <= 2e+226) {
		tmp = t_1;
	} else {
		tmp = (Math.PI * l) - (t_0 / (F * F));
	}
	return tmp;
}
def code(F, l):
	t_0 = math.tan((math.pi * l))
	t_1 = (math.pi * l) - ((F * F) / t_0)
	tmp = 0
	if (math.pi * l) <= -2e+22:
		tmp = t_1
	elif (math.pi * l) <= 7.5e+194:
		tmp = (math.pi * l) - ((t_0 / F) / F)
	elif (math.pi * l) <= 2e+226:
		tmp = t_1
	else:
		tmp = (math.pi * l) - (t_0 / (F * F))
	return tmp
function code(F, l)
	t_0 = tan(Float64(pi * l))
	t_1 = Float64(Float64(pi * l) - Float64(Float64(F * F) / t_0))
	tmp = 0.0
	if (Float64(pi * l) <= -2e+22)
		tmp = t_1;
	elseif (Float64(pi * l) <= 7.5e+194)
		tmp = Float64(Float64(pi * l) - Float64(Float64(t_0 / F) / F));
	elseif (Float64(pi * l) <= 2e+226)
		tmp = t_1;
	else
		tmp = Float64(Float64(pi * l) - Float64(t_0 / Float64(F * F)));
	end
	return tmp
end
function tmp_2 = code(F, l)
	t_0 = tan((pi * l));
	t_1 = (pi * l) - ((F * F) / t_0);
	tmp = 0.0;
	if ((pi * l) <= -2e+22)
		tmp = t_1;
	elseif ((pi * l) <= 7.5e+194)
		tmp = (pi * l) - ((t_0 / F) / F);
	elseif ((pi * l) <= 2e+226)
		tmp = t_1;
	else
		tmp = (pi * l) - (t_0 / (F * F));
	end
	tmp_2 = tmp;
end
code[F_, l_] := Block[{t$95$0 = N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * l), $MachinePrecision] - N[(N[(F * F), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(Pi * l), $MachinePrecision], -2e+22], t$95$1, If[LessEqual[N[(Pi * l), $MachinePrecision], 7.5e+194], N[(N[(Pi * l), $MachinePrecision] - N[(N[(t$95$0 / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], 2e+226], t$95$1, N[(N[(Pi * l), $MachinePrecision] - N[(t$95$0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan \left(\pi \cdot \ell\right)\\
t_1 := \pi \cdot \ell - \frac{F \cdot F}{t_0}\\
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{t_0}{F}}{F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{t_0}{F \cdot F}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -2e22 or 7.5000000000000002e194 < (*.f64 (PI.f64) l) < 1.99999999999999992e226

    1. Initial program 49.2%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(F \cdot F\right)}^{-1}} \cdot \tan \left(\pi \cdot \ell\right) \]
      2. unpow-prod-down49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left({F}^{-1} \cdot {F}^{-1}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      3. pow-prod-up49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{F}^{\left(-1 + -1\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      4. add-sqr-sqrt14.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      5. pow214.8%

        \[\leadsto \pi \cdot \ell - {\color{blue}{\left({\left(\sqrt{F}\right)}^{2}\right)}}^{\left(-1 + -1\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      6. pow-pow14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{\left(2 \cdot \left(-1 + -1\right)\right)}} \cdot \tan \left(\pi \cdot \ell\right) \]
      7. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\left(2 \cdot \color{blue}{-2}\right)} \cdot \tan \left(\pi \cdot \ell\right) \]
      8. metadata-eval14.8%

        \[\leadsto \pi \cdot \ell - {\left(\sqrt{F}\right)}^{\color{blue}{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    3. Applied egg-rr14.8%

      \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\sqrt{F}\right)}^{-4}} \cdot \tan \left(\pi \cdot \ell\right) \]
    4. Step-by-step derivation
      1. *-commutative14.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot {\left(\sqrt{F}\right)}^{-4}} \]
      2. sqrt-pow249.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{{F}^{\left(\frac{-4}{2}\right)}} \]
      3. sqr-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\left({F}^{\left(\frac{\frac{-4}{2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right)} \]
      4. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\left(\frac{\color{blue}{-2}}{2}\right)} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      5. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left({F}^{\color{blue}{-1}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      6. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\color{blue}{\frac{1}{F}} \cdot {F}^{\left(\frac{\frac{-4}{2}}{2}\right)}\right) \]
      7. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\left(\frac{\color{blue}{-2}}{2}\right)}\right) \]
      8. metadata-eval49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot {F}^{\color{blue}{-1}}\right) \]
      9. inv-pow49.2%

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \left(\frac{1}{F} \cdot \color{blue}{\frac{1}{F}}\right) \]
      10. associate-*r*49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\left(\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}\right) \cdot \frac{1}{F}} \]
      11. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}} \cdot \frac{1}{F} \]
      12. div-inv49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      13. clear-num49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}} \]
      14. unpow-149.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{{\left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right)}^{-1}} \]
      15. exp-to-pow25.3%

        \[\leadsto \pi \cdot \ell - \color{blue}{e^{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}} \]
      16. add-sqr-sqrt10.9%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1} \cdot \sqrt{\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1}}} \]
      17. sqrt-unprod16.3%

        \[\leadsto \pi \cdot \ell - e^{\color{blue}{\sqrt{\left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right) \cdot \left(\log \left(\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}\right) \cdot -1\right)}}} \]
    5. Applied egg-rr76.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}} \]

    if -2e22 < (*.f64 (PI.f64) l) < 7.5000000000000002e194

    1. Initial program 87.0%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/87.7%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-un-lft-identity87.7%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
      3. associate-/r*94.1%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    3. Applied egg-rr94.1%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]

    if 1.99999999999999992e226 < (*.f64 (PI.f64) l)

    1. Initial program 75.8%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/75.8%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-lft-identity75.8%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
    3. Simplified75.8%

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{elif}\;\pi \cdot \ell \leq 7.5 \cdot 10^{+194}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+226}:\\ \;\;\;\;\pi \cdot \ell - \frac{F \cdot F}{\tan \left(\pi \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \end{array} \]

Alternative 5: 81.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \cdot F \leq 2 \cdot 10^{-320}:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (<= (* F F) 2e-320)
   (- (* PI l) (* (/ l F) (/ PI F)))
   (- (* PI l) (/ (tan (* PI l)) (* F F)))))
double code(double F, double l) {
	double tmp;
	if ((F * F) <= 2e-320) {
		tmp = (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
	} else {
		tmp = (((double) M_PI) * l) - (tan((((double) M_PI) * l)) / (F * F));
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if ((F * F) <= 2e-320) {
		tmp = (Math.PI * l) - ((l / F) * (Math.PI / F));
	} else {
		tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if (F * F) <= 2e-320:
		tmp = (math.pi * l) - ((l / F) * (math.pi / F))
	else:
		tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F))
	return tmp
function code(F, l)
	tmp = 0.0
	if (Float64(F * F) <= 2e-320)
		tmp = Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F)));
	else
		tmp = Float64(Float64(pi * l) - Float64(tan(Float64(pi * l)) / Float64(F * F)));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if ((F * F) <= 2e-320)
		tmp = (pi * l) - ((l / F) * (pi / F));
	else
		tmp = (pi * l) - (tan((pi * l)) / (F * F));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 2e-320], N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 2 \cdot 10^{-320}:\\
\;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 F F) < 1.99998e-320

    1. Initial program 32.4%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Taylor expanded in l around 0 30.0%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell \cdot \pi}{{F}^{2}}} \]
    3. Step-by-step derivation
      1. unpow230.0%

        \[\leadsto \pi \cdot \ell - \frac{\ell \cdot \pi}{\color{blue}{F \cdot F}} \]
      2. times-frac49.2%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]
    4. Simplified49.2%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]

    if 1.99998e-320 < (*.f64 F F)

    1. Initial program 88.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Step-by-step derivation
      1. associate-*l/89.0%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      2. *-lft-identity89.0%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \cdot F \leq 2 \cdot 10^{-320}:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \end{array} \]

Alternative 6: 75.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F} \end{array} \]
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ l F) (/ PI F))))
double code(double F, double l) {
	return (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
public static double code(double F, double l) {
	return (Math.PI * l) - ((l / F) * (Math.PI / F));
}
def code(F, l):
	return (math.pi * l) - ((l / F) * (math.pi / F))
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F)))
end
function tmp = code(F, l)
	tmp = (pi * l) - ((l / F) * (pi / F));
end
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}
\end{array}
Derivation
  1. Initial program 76.1%

    \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
  2. Taylor expanded in l around 0 68.6%

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell \cdot \pi}{{F}^{2}}} \]
  3. Step-by-step derivation
    1. unpow268.6%

      \[\leadsto \pi \cdot \ell - \frac{\ell \cdot \pi}{\color{blue}{F \cdot F}} \]
    2. times-frac72.9%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]
  4. Simplified72.9%

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{F} \cdot \frac{\pi}{F}} \]
  5. Final simplification72.9%

    \[\leadsto \pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F} \]

Reproduce

?
herbie shell --seed 2023240 
(FPCore (F l)
  :name "VandenBroeck and Keller, Equation (6)"
  :precision binary64
  (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))