VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.4% → 87.2%
Time: 34.0s
Alternatives: 10
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 10 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: 87.2% accurate, 0.0× speedup?

\[\begin{array}{l} F = |F|\\ \\ \begin{array}{l} t_0 := {\pi}^{3} \cdot 0.3333333333333333\\ t_1 := \frac{t_0}{\pi}\\ t_2 := \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot t_1\right)\\ t_3 := {\pi}^{3} \cdot -0.16666666666666666\\ t_4 := \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, t_3\right)\\ t_5 := 0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, t_3 \cdot {\pi}^{2}\right)\\ \mathbf{if}\;F \leq 1.45 \cdot 10^{-158}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, t_4 - t_2, \mathsf{fma}\left({\ell}^{5}, \left(\mathsf{fma}\left(-0.5, t_5, \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{2}, t_0, {\pi}^{5} \cdot -0.001388888888888889\right)\right) - \mathsf{fma}\left({\pi}^{5}, -0.0001984126984126984, t_5 \cdot \frac{\pi \cdot -0.3333333333333333}{\pi}\right)\right) + t_1 \cdot \left(t_2 - t_4\right), \frac{1}{\pi \cdot \ell}\right)\right)\right) \cdot \frac{F}{\frac{1}{F}}}\\ \end{array} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (* (pow PI 3.0) 0.3333333333333333))
        (t_1 (/ t_0 PI))
        (t_2
         (fma
          (pow PI 3.0)
          0.008333333333333333
          (* (* PI -0.3333333333333333) t_1)))
        (t_3 (* (pow PI 3.0) -0.16666666666666666))
        (t_4 (fma (pow PI 3.0) 0.041666666666666664 t_3))
        (t_5
         (-
          (* 0.008333333333333333 (pow PI 5.0))
          (fma (pow PI 5.0) 0.041666666666666664 (* t_3 (pow PI 2.0))))))
   (if (<= F 1.45e-158)
     (- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))
     (+
      (* PI l)
      (/
       -1.0
       (*
        (fma
         l
         (* PI -0.3333333333333333)
         (fma
          (pow l 3.0)
          (- t_4 t_2)
          (fma
           (pow l 5.0)
           (+
            (-
             (fma
              -0.5
              t_5
              (fma
               (* 0.041666666666666664 (pow PI 2.0))
               t_0
               (* (pow PI 5.0) -0.001388888888888889)))
             (fma
              (pow PI 5.0)
              -0.0001984126984126984
              (* t_5 (/ (* PI -0.3333333333333333) PI))))
            (* t_1 (- t_2 t_4)))
           (/ 1.0 (* PI l)))))
        (/ F (/ 1.0 F))))))))
F = abs(F);
double code(double F, double l) {
	double t_0 = pow(((double) M_PI), 3.0) * 0.3333333333333333;
	double t_1 = t_0 / ((double) M_PI);
	double t_2 = fma(pow(((double) M_PI), 3.0), 0.008333333333333333, ((((double) M_PI) * -0.3333333333333333) * t_1));
	double t_3 = pow(((double) M_PI), 3.0) * -0.16666666666666666;
	double t_4 = fma(pow(((double) M_PI), 3.0), 0.041666666666666664, t_3);
	double t_5 = (0.008333333333333333 * pow(((double) M_PI), 5.0)) - fma(pow(((double) M_PI), 5.0), 0.041666666666666664, (t_3 * pow(((double) M_PI), 2.0)));
	double tmp;
	if (F <= 1.45e-158) {
		tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
	} else {
		tmp = (((double) M_PI) * l) + (-1.0 / (fma(l, (((double) M_PI) * -0.3333333333333333), fma(pow(l, 3.0), (t_4 - t_2), fma(pow(l, 5.0), ((fma(-0.5, t_5, fma((0.041666666666666664 * pow(((double) M_PI), 2.0)), t_0, (pow(((double) M_PI), 5.0) * -0.001388888888888889))) - fma(pow(((double) M_PI), 5.0), -0.0001984126984126984, (t_5 * ((((double) M_PI) * -0.3333333333333333) / ((double) M_PI))))) + (t_1 * (t_2 - t_4))), (1.0 / (((double) M_PI) * l))))) * (F / (1.0 / F))));
	}
	return tmp;
}
F = abs(F)
function code(F, l)
	t_0 = Float64((pi ^ 3.0) * 0.3333333333333333)
	t_1 = Float64(t_0 / pi)
	t_2 = fma((pi ^ 3.0), 0.008333333333333333, Float64(Float64(pi * -0.3333333333333333) * t_1))
	t_3 = Float64((pi ^ 3.0) * -0.16666666666666666)
	t_4 = fma((pi ^ 3.0), 0.041666666666666664, t_3)
	t_5 = Float64(Float64(0.008333333333333333 * (pi ^ 5.0)) - fma((pi ^ 5.0), 0.041666666666666664, Float64(t_3 * (pi ^ 2.0))))
	tmp = 0.0
	if (F <= 1.45e-158)
		tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F));
	else
		tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(fma(l, Float64(pi * -0.3333333333333333), fma((l ^ 3.0), Float64(t_4 - t_2), fma((l ^ 5.0), Float64(Float64(fma(-0.5, t_5, fma(Float64(0.041666666666666664 * (pi ^ 2.0)), t_0, Float64((pi ^ 5.0) * -0.001388888888888889))) - fma((pi ^ 5.0), -0.0001984126984126984, Float64(t_5 * Float64(Float64(pi * -0.3333333333333333) / pi)))) + Float64(t_1 * Float64(t_2 - t_4))), Float64(1.0 / Float64(pi * l))))) * Float64(F / Float64(1.0 / F)))));
	end
	return tmp
end
NOTE: F should be positive before calling this function
code[F_, l_] := Block[{t$95$0 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / Pi), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.008333333333333333 + N[(N[(Pi * -0.3333333333333333), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.041666666666666664 + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(0.008333333333333333 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 5.0], $MachinePrecision] * 0.041666666666666664 + N[(t$95$3 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 1.45e-158], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(t$95$4 - t$95$2), $MachinePrecision] + N[(N[Power[l, 5.0], $MachinePrecision] * N[(N[(N[(-0.5 * t$95$5 + N[(N[(0.041666666666666664 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(N[Power[Pi, 5.0], $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 5.0], $MachinePrecision] * -0.0001984126984126984 + N[(t$95$5 * N[(N[(Pi * -0.3333333333333333), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(t$95$2 - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
t_0 := {\pi}^{3} \cdot 0.3333333333333333\\
t_1 := \frac{t_0}{\pi}\\
t_2 := \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot t_1\right)\\
t_3 := {\pi}^{3} \cdot -0.16666666666666666\\
t_4 := \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, t_3\right)\\
t_5 := 0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, t_3 \cdot {\pi}^{2}\right)\\
\mathbf{if}\;F \leq 1.45 \cdot 10^{-158}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, t_4 - t_2, \mathsf{fma}\left({\ell}^{5}, \left(\mathsf{fma}\left(-0.5, t_5, \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{2}, t_0, {\pi}^{5} \cdot -0.001388888888888889\right)\right) - \mathsf{fma}\left({\pi}^{5}, -0.0001984126984126984, t_5 \cdot \frac{\pi \cdot -0.3333333333333333}{\pi}\right)\right) + t_1 \cdot \left(t_2 - t_4\right), \frac{1}{\pi \cdot \ell}\right)\right)\right) \cdot \frac{F}{\frac{1}{F}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 1.4499999999999999e-158

    1. Initial program 66.9%

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

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

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt75.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{\left(\sqrt{\pi} \cdot \sqrt{\pi}\right)} \cdot \ell\right)}{F}}{F} \]
      2. pow275.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{{\left(\sqrt{\pi}\right)}^{2}} \cdot \ell\right)}{F}}{F} \]
    5. Applied egg-rr75.7%

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

    if 1.4499999999999999e-158 < F

    1. Initial program 85.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      4. add-sqr-sqrt85.7%

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F \cdot F}}} \]
      6. sqr-neg85.8%

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{-F} \cdot \sqrt{-F}}} \]
      8. add-sqr-sqrt68.2%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F \cdot \left(-F\right)}{\tan \left(\pi \cdot \ell\right)}}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{-F} \cdot \sqrt{-F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      12. sqrt-unprod85.8%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\sqrt{\left(-F\right) \cdot \left(-F\right)}}}{\tan \left(\pi \cdot \ell\right)}} \]
      13. sqr-neg85.8%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      15. add-sqr-sqrt85.8%

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

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

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

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{1 \cdot F}{\color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}}}} \]
      5. times-frac85.7%

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

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{1}{\tan \left(\pi \cdot \ell\right)} \cdot \frac{F}{\frac{1}{F}}}} \]
    6. Taylor expanded in l around 0 98.4%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\left(\ell \cdot \left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) + \left({\ell}^{3} \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right) + \left({\ell}^{5} \cdot \left(\left(-0.5 \cdot \left(0.008333333333333333 \cdot {\pi}^{5} - \left(-0.5 \cdot \left({\pi}^{2} \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)\right) + 0.041666666666666664 \cdot {\pi}^{5}\right)\right) + \left(-0.001388888888888889 \cdot {\pi}^{5} + 0.041666666666666664 \cdot \left({\pi}^{2} \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)\right)\right)\right) - \left(-0.0001984126984126984 \cdot {\pi}^{5} + \left(\frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(0.008333333333333333 \cdot {\pi}^{5} - \left(-0.5 \cdot \left({\pi}^{2} \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)\right) + 0.041666666666666664 \cdot {\pi}^{5}\right)\right)}{\pi} + \frac{\left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right)}{\pi}\right)\right)\right) + \frac{1}{\ell \cdot \pi}\right)\right)\right)} \cdot \frac{F}{\frac{1}{F}}} \]
    7. Simplified98.4%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, -0.16666666666666666 \cdot {\pi}^{3}\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \mathsf{fma}\left({\ell}^{5}, \left(\mathsf{fma}\left(-0.5, 0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left(-0.16666666666666666 \cdot {\pi}^{3}\right) \cdot {\pi}^{2}\right), \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{2}, {\pi}^{3} \cdot 0.3333333333333333, {\pi}^{5} \cdot -0.001388888888888889\right)\right) - \mathsf{fma}\left({\pi}^{5}, -0.0001984126984126984, \frac{\pi \cdot -0.3333333333333333}{\pi} \cdot \left(0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left(-0.16666666666666666 \cdot {\pi}^{3}\right) \cdot {\pi}^{2}\right)\right)\right)\right) - \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi} \cdot \left(\mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, -0.16666666666666666 \cdot {\pi}^{3}\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right)\right), \frac{1}{\ell \cdot \pi}\right)\right)\right)} \cdot \frac{F}{\frac{1}{F}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 1.45 \cdot 10^{-158}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \mathsf{fma}\left({\ell}^{5}, \left(\mathsf{fma}\left(-0.5, 0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left({\pi}^{3} \cdot -0.16666666666666666\right) \cdot {\pi}^{2}\right), \mathsf{fma}\left(0.041666666666666664 \cdot {\pi}^{2}, {\pi}^{3} \cdot 0.3333333333333333, {\pi}^{5} \cdot -0.001388888888888889\right)\right) - \mathsf{fma}\left({\pi}^{5}, -0.0001984126984126984, \left(0.008333333333333333 \cdot {\pi}^{5} - \mathsf{fma}\left({\pi}^{5}, 0.041666666666666664, \left({\pi}^{3} \cdot -0.16666666666666666\right) \cdot {\pi}^{2}\right)\right) \cdot \frac{\pi \cdot -0.3333333333333333}{\pi}\right)\right) + \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi} \cdot \left(\mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right) - \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right)\right), \frac{1}{\pi \cdot \ell}\right)\right)\right) \cdot \frac{F}{\frac{1}{F}}}\\ \end{array} \]

Alternative 2: 86.8% accurate, 0.2× speedup?

\[\begin{array}{l} F = |F|\\ \\ \begin{array}{l} \mathbf{if}\;F \leq 1.65 \cdot 10^{-158}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \frac{1}{\pi \cdot \ell}\right)\right)}\\ \end{array} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l)
 :precision binary64
 (if (<= F 1.65e-158)
   (- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))
   (+
    (* PI l)
    (/
     -1.0
     (*
      (/ F (/ 1.0 F))
      (fma
       l
       (* PI -0.3333333333333333)
       (fma
        (pow l 3.0)
        (-
         (fma
          (pow PI 3.0)
          0.041666666666666664
          (* (pow PI 3.0) -0.16666666666666666))
         (fma
          (pow PI 3.0)
          0.008333333333333333
          (*
           (* PI -0.3333333333333333)
           (/ (* (pow PI 3.0) 0.3333333333333333) PI))))
        (/ 1.0 (* PI l)))))))))
F = abs(F);
double code(double F, double l) {
	double tmp;
	if (F <= 1.65e-158) {
		tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
	} else {
		tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), fma(pow(l, 3.0), (fma(pow(((double) M_PI), 3.0), 0.041666666666666664, (pow(((double) M_PI), 3.0) * -0.16666666666666666)) - fma(pow(((double) M_PI), 3.0), 0.008333333333333333, ((((double) M_PI) * -0.3333333333333333) * ((pow(((double) M_PI), 3.0) * 0.3333333333333333) / ((double) M_PI))))), (1.0 / (((double) M_PI) * l))))));
	}
	return tmp;
}
F = abs(F)
function code(F, l)
	tmp = 0.0
	if (F <= 1.65e-158)
		tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F));
	else
		tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), fma((l ^ 3.0), Float64(fma((pi ^ 3.0), 0.041666666666666664, Float64((pi ^ 3.0) * -0.16666666666666666)) - fma((pi ^ 3.0), 0.008333333333333333, Float64(Float64(pi * -0.3333333333333333) * Float64(Float64((pi ^ 3.0) * 0.3333333333333333) / pi)))), Float64(1.0 / Float64(pi * l)))))));
	end
	return tmp
end
NOTE: F should be positive before calling this function
code[F_, l_] := If[LessEqual[F, 1.65e-158], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.041666666666666664 + N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.008333333333333333 + N[(N[(Pi * -0.3333333333333333), $MachinePrecision] * N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.65 \cdot 10^{-158}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \frac{1}{\pi \cdot \ell}\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 1.6500000000000001e-158

    1. Initial program 66.9%

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

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

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt75.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{\left(\sqrt{\pi} \cdot \sqrt{\pi}\right)} \cdot \ell\right)}{F}}{F} \]
      2. pow275.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{{\left(\sqrt{\pi}\right)}^{2}} \cdot \ell\right)}{F}}{F} \]
    5. Applied egg-rr75.7%

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

    if 1.6500000000000001e-158 < F

    1. Initial program 85.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      4. add-sqr-sqrt85.7%

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F \cdot F}}} \]
      6. sqr-neg85.8%

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{-F} \cdot \sqrt{-F}}} \]
      8. add-sqr-sqrt68.2%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F \cdot \left(-F\right)}{\tan \left(\pi \cdot \ell\right)}}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{-F} \cdot \sqrt{-F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      12. sqrt-unprod85.8%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\sqrt{\left(-F\right) \cdot \left(-F\right)}}}{\tan \left(\pi \cdot \ell\right)}} \]
      13. sqr-neg85.8%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      15. add-sqr-sqrt85.8%

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

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

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

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{1 \cdot F}{\color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}}}} \]
      5. times-frac85.7%

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

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{1}{\tan \left(\pi \cdot \ell\right)} \cdot \frac{F}{\frac{1}{F}}}} \]
    6. Taylor expanded in l around 0 98.4%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\left(\ell \cdot \left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) + \left({\ell}^{3} \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right) + \frac{1}{\ell \cdot \pi}\right)\right)} \cdot \frac{F}{\frac{1}{F}}} \]
    7. Step-by-step derivation
      1. fma-def98.4%

        \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, -0.5 \cdot \pi - -0.16666666666666666 \cdot \pi, {\ell}^{3} \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right) + \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]
      2. distribute-rgt-out--98.4%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \color{blue}{\pi \cdot \left(-0.5 - -0.16666666666666666\right)}, {\ell}^{3} \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right) + \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
      3. metadata-eval98.4%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \pi \cdot \color{blue}{-0.3333333333333333}, {\ell}^{3} \cdot \left(\left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right)\right) + \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
      4. fma-def98.4%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \color{blue}{\mathsf{fma}\left({\ell}^{3}, \left(-0.5 \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right) + 0.041666666666666664 \cdot {\pi}^{3}\right) - \left(0.008333333333333333 \cdot {\pi}^{3} + \frac{\left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) \cdot \left(-0.16666666666666666 \cdot {\pi}^{3} - -0.5 \cdot {\pi}^{3}\right)}{\pi}\right), \frac{1}{\ell \cdot \pi}\right)}\right) \cdot \frac{F}{\frac{1}{F}}} \]
    8. Simplified98.4%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, -0.16666666666666666 \cdot {\pi}^{3}\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \frac{1}{\ell \cdot \pi}\right)\right)} \cdot \frac{F}{\frac{1}{F}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 1.65 \cdot 10^{-158}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \mathsf{fma}\left({\ell}^{3}, \mathsf{fma}\left({\pi}^{3}, 0.041666666666666664, {\pi}^{3} \cdot -0.16666666666666666\right) - \mathsf{fma}\left({\pi}^{3}, 0.008333333333333333, \left(\pi \cdot -0.3333333333333333\right) \cdot \frac{{\pi}^{3} \cdot 0.3333333333333333}{\pi}\right), \frac{1}{\pi \cdot \ell}\right)\right)}\\ \end{array} \]

Alternative 3: 85.0% accurate, 0.6× speedup?

\[\begin{array}{l} F = |F|\\ \\ \begin{array}{l} \mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \end{array} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l)
 :precision binary64
 (if (<= (/ 1.0 (* F F)) 2e+298)
   (+
    (* PI l)
    (/
     -1.0
     (* (/ F (/ 1.0 F)) (fma l (* PI -0.3333333333333333) (/ 1.0 (* PI l))))))
   (- (* PI l) (/ (/ (tan (* l (pow (sqrt PI) 2.0))) F) F))))
F = abs(F);
double code(double F, double l) {
	double tmp;
	if ((1.0 / (F * F)) <= 2e+298) {
		tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), (1.0 / (((double) M_PI) * l)))));
	} else {
		tmp = (((double) M_PI) * l) - ((tan((l * pow(sqrt(((double) M_PI)), 2.0))) / F) / F);
	}
	return tmp;
}
F = abs(F)
function code(F, l)
	tmp = 0.0
	if (Float64(1.0 / Float64(F * F)) <= 2e+298)
		tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), Float64(1.0 / Float64(pi * l))))));
	else
		tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(l * (sqrt(pi) ^ 2.0))) / F) / F));
	end
	return tmp
end
NOTE: F should be positive before calling this function
code[F_, l_] := If[LessEqual[N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision], 2e+298], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(l * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 1 (*.f64 F F)) < 1.9999999999999999e298

    1. Initial program 89.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      4. add-sqr-sqrt39.4%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F} \cdot \sqrt{F}}} \]
      5. sqrt-prod82.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F \cdot F}}} \]
      6. sqr-neg82.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\sqrt{\color{blue}{\left(-F\right) \cdot \left(-F\right)}}} \]
      7. sqrt-unprod43.2%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{-F} \cdot \sqrt{-F}}} \]
      8. add-sqr-sqrt74.6%

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot \left(-F\right)}} \]
      10. clear-num74.6%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{-F} \cdot \sqrt{-F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      12. sqrt-unprod82.6%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\sqrt{\left(-F\right) \cdot \left(-F\right)}}}{\tan \left(\pi \cdot \ell\right)}} \]
      13. sqr-neg82.6%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      15. add-sqr-sqrt89.7%

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{{F}^{2}}{\tan \left(\pi \cdot \ell\right)}}} \]
    4. Step-by-step derivation
      1. pow289.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{1 \cdot F}{\color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}}}} \]
      5. times-frac89.7%

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

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{1}{\tan \left(\pi \cdot \ell\right)} \cdot \frac{F}{\frac{1}{F}}}} \]
    6. Taylor expanded in l around 0 96.5%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\left(\ell \cdot \left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) + \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]
    7. Step-by-step derivation
      1. fma-def96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, -0.5 \cdot \pi - -0.16666666666666666 \cdot \pi, \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]
      2. distribute-rgt-out--96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \color{blue}{\pi \cdot \left(-0.5 - -0.16666666666666666\right)}, \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
      3. metadata-eval96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \pi \cdot \color{blue}{-0.3333333333333333}, \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
    8. Simplified96.5%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]

    if 1.9999999999999999e298 < (/.f64 1 (*.f64 F F))

    1. Initial program 28.6%

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

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

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt50.5%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{\left(\sqrt{\pi} \cdot \sqrt{\pi}\right)} \cdot \ell\right)}{F}}{F} \]
      2. pow250.5%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\color{blue}{{\left(\sqrt{\pi}\right)}^{2}} \cdot \ell\right)}{F}}{F} \]
    5. Applied egg-rr50.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot {\left(\sqrt{\pi}\right)}^{2}\right)}{F}}{F}\\ \end{array} \]

Alternative 4: 85.1% accurate, 0.7× speedup?

\[\begin{array}{l} F = |F|\\ \\ \begin{array}{l} \mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\ \end{array} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l)
 :precision binary64
 (if (<= (/ 1.0 (* F F)) 2e+298)
   (+
    (* PI l)
    (/
     -1.0
     (* (/ F (/ 1.0 F)) (fma l (* PI -0.3333333333333333) (/ 1.0 (* PI l))))))
   (- (* PI l) (/ 1.0 (/ F (/ (tan (* PI l)) F))))))
F = abs(F);
double code(double F, double l) {
	double tmp;
	if ((1.0 / (F * F)) <= 2e+298) {
		tmp = (((double) M_PI) * l) + (-1.0 / ((F / (1.0 / F)) * fma(l, (((double) M_PI) * -0.3333333333333333), (1.0 / (((double) M_PI) * l)))));
	} else {
		tmp = (((double) M_PI) * l) - (1.0 / (F / (tan((((double) M_PI) * l)) / F)));
	}
	return tmp;
}
F = abs(F)
function code(F, l)
	tmp = 0.0
	if (Float64(1.0 / Float64(F * F)) <= 2e+298)
		tmp = Float64(Float64(pi * l) + Float64(-1.0 / Float64(Float64(F / Float64(1.0 / F)) * fma(l, Float64(pi * -0.3333333333333333), Float64(1.0 / Float64(pi * l))))));
	else
		tmp = Float64(Float64(pi * l) - Float64(1.0 / Float64(F / Float64(tan(Float64(pi * l)) / F))));
	end
	return tmp
end
NOTE: F should be positive before calling this function
code[F_, l_] := If[LessEqual[N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision], 2e+298], N[(N[(Pi * l), $MachinePrecision] + N[(-1.0 / N[(N[(F / N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * N[(l * N[(Pi * -0.3333333333333333), $MachinePrecision] + N[(1.0 / N[(Pi * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(1.0 / N[(F / N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 1 (*.f64 F F)) < 1.9999999999999999e298

    1. Initial program 89.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      4. add-sqr-sqrt39.4%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F} \cdot \sqrt{F}}} \]
      5. sqrt-prod82.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F \cdot F}}} \]
      6. sqr-neg82.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\sqrt{\color{blue}{\left(-F\right) \cdot \left(-F\right)}}} \]
      7. sqrt-unprod43.2%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{-F} \cdot \sqrt{-F}}} \]
      8. add-sqr-sqrt74.6%

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot \left(-F\right)}} \]
      10. clear-num74.6%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{-F} \cdot \sqrt{-F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      12. sqrt-unprod82.6%

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\sqrt{\left(-F\right) \cdot \left(-F\right)}}}{\tan \left(\pi \cdot \ell\right)}} \]
      13. sqr-neg82.6%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      15. add-sqr-sqrt89.7%

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{{F}^{2}}{\tan \left(\pi \cdot \ell\right)}}} \]
    4. Step-by-step derivation
      1. pow289.7%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{1 \cdot F}{\color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}}}} \]
      5. times-frac89.7%

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

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{1}{\tan \left(\pi \cdot \ell\right)} \cdot \frac{F}{\frac{1}{F}}}} \]
    6. Taylor expanded in l around 0 96.5%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\left(\ell \cdot \left(-0.5 \cdot \pi - -0.16666666666666666 \cdot \pi\right) + \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]
    7. Step-by-step derivation
      1. fma-def96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, -0.5 \cdot \pi - -0.16666666666666666 \cdot \pi, \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]
      2. distribute-rgt-out--96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \color{blue}{\pi \cdot \left(-0.5 - -0.16666666666666666\right)}, \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
      3. metadata-eval96.5%

        \[\leadsto \pi \cdot \ell - \frac{1}{\mathsf{fma}\left(\ell, \pi \cdot \color{blue}{-0.3333333333333333}, \frac{1}{\ell \cdot \pi}\right) \cdot \frac{F}{\frac{1}{F}}} \]
    8. Simplified96.5%

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\ell \cdot \pi}\right)} \cdot \frac{F}{\frac{1}{F}}} \]

    if 1.9999999999999999e298 < (/.f64 1 (*.f64 F F))

    1. Initial program 28.6%

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      4. add-sqr-sqrt23.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F} \cdot \sqrt{F}}} \]
      5. sqrt-prod18.2%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{F \cdot F}}} \]
      6. sqr-neg18.2%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\sqrt{\color{blue}{\left(-F\right) \cdot \left(-F\right)}}} \]
      7. sqrt-unprod0.9%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{\color{blue}{\sqrt{-F} \cdot \sqrt{-F}}} \]
      8. add-sqr-sqrt1.7%

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot \left(-F\right)}} \]
      10. clear-num1.7%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F \cdot \left(-F\right)}{\tan \left(\pi \cdot \ell\right)}}} \]
      11. add-sqr-sqrt0.8%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\sqrt{\left(-F\right) \cdot \left(-F\right)}}}{\tan \left(\pi \cdot \ell\right)}} \]
      13. sqr-neg18.2%

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{F}\right)}}{\tan \left(\pi \cdot \ell\right)}} \]
      15. add-sqr-sqrt30.6%

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{{F}^{2}}{\tan \left(\pi \cdot \ell\right)}}} \]
    4. Step-by-step derivation
      1. pow230.6%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{1}{\frac{1 \cdot F}{\color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F}}}} \]
      5. times-frac30.6%

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

      \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{1}{\tan \left(\pi \cdot \ell\right)} \cdot \frac{F}{\frac{1}{F}}}} \]
    6. Step-by-step derivation
      1. frac-times50.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{F \cdot F} \leq 2 \cdot 10^{+298}:\\ \;\;\;\;\pi \cdot \ell + \frac{-1}{\frac{F}{\frac{1}{F}} \cdot \mathsf{fma}\left(\ell, \pi \cdot -0.3333333333333333, \frac{1}{\pi \cdot \ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}\\ \end{array} \]

Alternative 5: 81.8% accurate, 1.0× speedup?

\[\begin{array}{l} F = |F|\\ \\ \begin{array}{l} \mathbf{if}\;F \cdot F \leq 4 \cdot 10^{-316}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{F}}}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \end{array} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l)
 :precision binary64
 (if (<= (* F F) 4e-316)
   (- (* PI l) (/ PI (/ F (/ l F))))
   (- (* PI l) (/ (tan (* PI l)) (* F F)))))
F = abs(F);
double code(double F, double l) {
	double tmp;
	if ((F * F) <= 4e-316) {
		tmp = (((double) M_PI) * l) - (((double) M_PI) / (F / (l / F)));
	} else {
		tmp = (((double) M_PI) * l) - (tan((((double) M_PI) * l)) / (F * F));
	}
	return tmp;
}
F = Math.abs(F);
public static double code(double F, double l) {
	double tmp;
	if ((F * F) <= 4e-316) {
		tmp = (Math.PI * l) - (Math.PI / (F / (l / F)));
	} else {
		tmp = (Math.PI * l) - (Math.tan((Math.PI * l)) / (F * F));
	}
	return tmp;
}
F = abs(F)
def code(F, l):
	tmp = 0
	if (F * F) <= 4e-316:
		tmp = (math.pi * l) - (math.pi / (F / (l / F)))
	else:
		tmp = (math.pi * l) - (math.tan((math.pi * l)) / (F * F))
	return tmp
F = abs(F)
function code(F, l)
	tmp = 0.0
	if (Float64(F * F) <= 4e-316)
		tmp = Float64(Float64(pi * l) - Float64(pi / Float64(F / Float64(l / F))));
	else
		tmp = Float64(Float64(pi * l) - Float64(tan(Float64(pi * l)) / Float64(F * F)));
	end
	return tmp
end
F = abs(F)
function tmp_2 = code(F, l)
	tmp = 0.0;
	if ((F * F) <= 4e-316)
		tmp = (pi * l) - (pi / (F / (l / F)));
	else
		tmp = (pi * l) - (tan((pi * l)) / (F * F));
	end
	tmp_2 = tmp;
end
NOTE: F should be positive before calling this function
code[F_, l_] := If[LessEqual[N[(F * F), $MachinePrecision], 4e-316], N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F / N[(l / F), $MachinePrecision]), $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}
F = |F|\\
\\
\begin{array}{l}
\mathbf{if}\;F \cdot F \leq 4 \cdot 10^{-316}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{\frac{F}{\frac{\ell}{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) < 3.999999984e-316

    1. Initial program 27.6%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{\left(-F\right) \cdot \left(-F\right)} \]
      4. sqr-neg29.6%

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
    4. Taylor expanded in l around 0 28.5%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\ell \cdot \pi}}{F \cdot F} \]
    5. Step-by-step derivation
      1. *-commutative28.5%

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{F} \cdot \frac{\ell}{F}} \]
    6. Applied egg-rr48.5%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{F} \cdot \frac{\ell}{F}} \]
    7. Step-by-step derivation
      1. associate-*l/48.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi \cdot \frac{\ell}{F}}{F}} \]
      2. associate-/l*48.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{\frac{F}{\frac{\ell}{F}}}} \]
    8. Applied egg-rr48.6%

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

    if 3.999999984e-316 < (*.f64 F F)

    1. Initial program 89.8%

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

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

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

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

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

      \[\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 simplification78.8%

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

Alternative 6: 82.5% accurate, 1.0× speedup?

\[\begin{array}{l} F = |F|\\ \\ \pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (tan (* PI l)) F) F)))
F = abs(F);
double code(double F, double l) {
	return (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
}
F = Math.abs(F);
public static double code(double F, double l) {
	return (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
}
F = abs(F)
def code(F, l):
	return (math.pi * l) - ((math.tan((math.pi * l)) / F) / F)
F = abs(F)
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F))
end
F = abs(F)
function tmp = code(F, l)
	tmp = (pi * l) - ((tan((pi * l)) / F) / F);
end
NOTE: F should be positive before calling this function
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

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

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

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

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

Alternative 7: 74.6% accurate, 1.0× speedup?

\[\begin{array}{l} F = |F|\\ \\ \mathsf{fma}\left(\pi, \ell, \frac{\frac{\pi \cdot \ell}{-F}}{F}\right) \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l) :precision binary64 (fma PI l (/ (/ (* PI l) (- F)) F)))
F = abs(F);
double code(double F, double l) {
	return fma(((double) M_PI), l, (((((double) M_PI) * l) / -F) / F));
}
F = abs(F)
function code(F, l)
	return fma(pi, l, Float64(Float64(Float64(pi * l) / Float64(-F)) / F))
end
NOTE: F should be positive before calling this function
code[F_, l_] := N[(Pi * l + N[(N[(N[(Pi * l), $MachinePrecision] / (-F)), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\mathsf{fma}\left(\pi, \ell, \frac{\frac{\pi \cdot \ell}{-F}}{F}\right)
\end{array}
Derivation
  1. Initial program 73.2%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\pi, \ell, -\frac{1}{\left(-F\right) \cdot \left(-F\right)} \cdot \tan \left(\pi \cdot \ell\right)\right)} \]
    5. associate-*l/73.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{\left(-F\right) \cdot \left(-F\right)}}\right) \]
    6. times-frac79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\frac{1}{-F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}}\right) \]
    7. distribute-lft-neg-in79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\left(-\frac{1}{-F}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}}\right) \]
    8. neg-mul-179.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\frac{1}{\color{blue}{-1 \cdot F}}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
    9. associate-/r*79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\color{blue}{\frac{\frac{1}{-1}}{F}}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
    10. metadata-eval79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\frac{\color{blue}{-1}}{F}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
    11. distribute-neg-frac79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\frac{--1}{F}} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
    12. metadata-eval79.1%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\color{blue}{1}}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
    13. times-frac73.8%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\pi, \ell, \frac{\frac{\tan \left(\pi \cdot \ell\right)}{-F}}{F}\right)} \]
  4. Taylor expanded in l around 0 73.4%

    \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\frac{\color{blue}{\ell \cdot \pi}}{-F}}{F}\right) \]
  5. Final simplification73.4%

    \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\frac{\pi \cdot \ell}{-F}}{F}\right) \]

Alternative 8: 74.6% accurate, 1.5× speedup?

\[\begin{array}{l} F = |F|\\ \\ \pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l) :precision binary64 (- (* PI l) (* (/ l F) (/ PI F))))
F = abs(F);
double code(double F, double l) {
	return (((double) M_PI) * l) - ((l / F) * (((double) M_PI) / F));
}
F = Math.abs(F);
public static double code(double F, double l) {
	return (Math.PI * l) - ((l / F) * (Math.PI / F));
}
F = abs(F)
def code(F, l):
	return (math.pi * l) - ((l / F) * (math.pi / F))
F = abs(F)
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(l / F) * Float64(pi / F)))
end
F = abs(F)
function tmp = code(F, l)
	tmp = (pi * l) - ((l / F) * (pi / F));
end
NOTE: F should be positive before calling this function
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(l / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

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

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

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

    \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  4. Taylor expanded in l around 0 68.1%

    \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\ell \cdot \pi}}{F \cdot F} \]
  5. Step-by-step derivation
    1. *-commutative68.1%

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

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

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{F} \cdot \frac{\ell}{F}} \]
  7. Final simplification73.4%

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

Alternative 9: 74.6% accurate, 1.5× speedup?

\[\begin{array}{l} F = |F|\\ \\ \pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l) :precision binary64 (- (* PI l) (/ (/ (* PI l) F) F)))
F = abs(F);
double code(double F, double l) {
	return (((double) M_PI) * l) - (((((double) M_PI) * l) / F) / F);
}
F = Math.abs(F);
public static double code(double F, double l) {
	return (Math.PI * l) - (((Math.PI * l) / F) / F);
}
F = abs(F)
def code(F, l):
	return (math.pi * l) - (((math.pi * l) / F) / F)
F = abs(F)
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(Float64(pi * l) / F) / F))
end
F = abs(F)
function tmp = code(F, l)
	tmp = (pi * l) - (((pi * l) / F) / F);
end
NOTE: F should be positive before calling this function
code[F_, l_] := N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[(Pi * l), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

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

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

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
  4. Taylor expanded in l around 0 73.4%

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

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

Alternative 10: 27.0% accurate, 2.9× speedup?

\[\begin{array}{l} F = |F|\\ \\ \frac{-\pi}{F \cdot \frac{F}{\ell}} \end{array} \]
NOTE: F should be positive before calling this function
(FPCore (F l) :precision binary64 (/ (- PI) (* F (/ F l))))
F = abs(F);
double code(double F, double l) {
	return -((double) M_PI) / (F * (F / l));
}
F = Math.abs(F);
public static double code(double F, double l) {
	return -Math.PI / (F * (F / l));
}
F = abs(F)
def code(F, l):
	return -math.pi / (F * (F / l))
F = abs(F)
function code(F, l)
	return Float64(Float64(-pi) / Float64(F * Float64(F / l)))
end
F = abs(F)
function tmp = code(F, l)
	tmp = -pi / (F * (F / l));
end
NOTE: F should be positive before calling this function
code[F_, l_] := N[((-Pi) / N[(F * N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
F = |F|\\
\\
\frac{-\pi}{F \cdot \frac{F}{\ell}}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

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

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

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

    \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  4. Taylor expanded in l around 0 68.1%

    \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\ell \cdot \pi}}{F \cdot F} \]
  5. Step-by-step derivation
    1. *-commutative68.1%

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

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

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{F} \cdot \frac{\ell}{F}} \]
  7. Taylor expanded in F around 0 21.0%

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

      \[\leadsto \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}} \]
    2. *-commutative21.0%

      \[\leadsto -\frac{\color{blue}{\pi \cdot \ell}}{{F}^{2}} \]
    3. associate-/l*20.9%

      \[\leadsto -\color{blue}{\frac{\pi}{\frac{{F}^{2}}{\ell}}} \]
  9. Simplified20.9%

    \[\leadsto \color{blue}{-\frac{\pi}{\frac{{F}^{2}}{\ell}}} \]
  10. Step-by-step derivation
    1. unpow220.9%

      \[\leadsto -\frac{\pi}{\frac{\color{blue}{F \cdot F}}{\ell}} \]
    2. *-un-lft-identity20.9%

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

      \[\leadsto -\frac{\pi}{\color{blue}{\frac{F}{1} \cdot \frac{F}{\ell}}} \]
    4. /-rgt-identity26.2%

      \[\leadsto -\frac{\pi}{\color{blue}{F} \cdot \frac{F}{\ell}} \]
  11. Applied egg-rr26.2%

    \[\leadsto -\frac{\pi}{\color{blue}{F \cdot \frac{F}{\ell}}} \]
  12. Final simplification26.2%

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

Reproduce

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