VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.3% → 99.3%
Time: 14.6s
Alternatives: 9
Speedup: 6.3×

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

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

Initial Program: 76.3% 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: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot l\_m + \frac{\frac{\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot l\_m\right)\right)\right) \cdot \frac{-1}{\cos \left(\pi \cdot l\_m\right)}}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 2e+14)
    (+
     (* PI l_m)
     (/
      (/ (* (sin (expm1 (log1p (* PI l_m)))) (/ -1.0 (cos (* PI l_m)))) F)
      F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 2e+14) {
		tmp = (((double) M_PI) * l_m) + (((sin(expm1(log1p((((double) M_PI) * l_m)))) * (-1.0 / cos((((double) M_PI) * l_m)))) / F) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 2e+14) {
		tmp = (Math.PI * l_m) + (((Math.sin(Math.expm1(Math.log1p((Math.PI * l_m)))) * (-1.0 / Math.cos((Math.PI * l_m)))) / F) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 2e+14:
		tmp = (math.pi * l_m) + (((math.sin(math.expm1(math.log1p((math.pi * l_m)))) * (-1.0 / math.cos((math.pi * l_m)))) / F) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 2e+14)
		tmp = Float64(Float64(pi * l_m) + Float64(Float64(Float64(sin(expm1(log1p(Float64(pi * l_m)))) * Float64(-1.0 / cos(Float64(pi * l_m)))) / F) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+14], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(N[(N[Sin[N[(Exp[N[Log[1 + N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Cos[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\pi \cdot l\_m + \frac{\frac{\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot l\_m\right)\right)\right) \cdot \frac{-1}{\cos \left(\pi \cdot l\_m\right)}}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 2e14

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}}}{F}}{F} \]
      2. div-inv87.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\sin \left(\pi \cdot \ell\right) \cdot \frac{1}{\cos \left(\pi \cdot \ell\right)}}}{F}}{F} \]
    6. Applied egg-rr87.7%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\sin \left(\pi \cdot \ell\right) \cdot \frac{1}{\cos \left(\pi \cdot \ell\right)}}}{F}}{F} \]
    7. Step-by-step derivation
      1. expm1-log1p-u67.9%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)} \cdot \frac{1}{\cos \left(\pi \cdot \ell\right)}}{F}}{F} \]
    8. Applied egg-rr67.9%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right)} \cdot \frac{1}{\cos \left(\pi \cdot \ell\right)}}{F}}{F} \]

    if 2e14 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot \ell + \frac{\frac{\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \ell\right)\right)\right) \cdot \frac{-1}{\cos \left(\pi \cdot \ell\right)}}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.3% accurate, 0.4× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\tan \left(\pi \cdot l\_m\right)\right)\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 2e+14)
    (- (* PI l_m) (/ (/ (log1p (expm1 (tan (* PI l_m)))) F) F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 2e+14) {
		tmp = (((double) M_PI) * l_m) - ((log1p(expm1(tan((((double) M_PI) * l_m)))) / F) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 2e+14) {
		tmp = (Math.PI * l_m) - ((Math.log1p(Math.expm1(Math.tan((Math.PI * l_m)))) / F) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 2e+14:
		tmp = (math.pi * l_m) - ((math.log1p(math.expm1(math.tan((math.pi * l_m)))) / F) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 2e+14)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(log1p(expm1(tan(Float64(pi * l_m)))) / F) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+14], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Log[1 + N[(Exp[N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\tan \left(\pi \cdot l\_m\right)\right)\right)}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 2e14

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

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

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

    if 2e14 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\tan \left(\pi \cdot \ell\right)\right)\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.3% accurate, 0.5× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot l\_m + \frac{\frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{\cos \left(\pi \cdot l\_m\right)}}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 2e+14)
    (+ (* PI l_m) (/ (/ (* (sin (* PI l_m)) (/ -1.0 (cos (* PI l_m)))) F) F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 2e+14) {
		tmp = (((double) M_PI) * l_m) + (((sin((((double) M_PI) * l_m)) * (-1.0 / cos((((double) M_PI) * l_m)))) / F) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 2e+14) {
		tmp = (Math.PI * l_m) + (((Math.sin((Math.PI * l_m)) * (-1.0 / Math.cos((Math.PI * l_m)))) / F) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 2e+14:
		tmp = (math.pi * l_m) + (((math.sin((math.pi * l_m)) * (-1.0 / math.cos((math.pi * l_m)))) / F) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 2e+14)
		tmp = Float64(Float64(pi * l_m) + Float64(Float64(Float64(sin(Float64(pi * l_m)) * Float64(-1.0 / cos(Float64(pi * l_m)))) / F) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 2e+14)
		tmp = (pi * l_m) + (((sin((pi * l_m)) * (-1.0 / cos((pi * l_m)))) / F) / F);
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+14], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[Cos[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\pi \cdot l\_m + \frac{\frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{\cos \left(\pi \cdot l\_m\right)}}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 2e14

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}}}{F}}{F} \]
      2. div-inv87.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\sin \left(\pi \cdot \ell\right) \cdot \frac{1}{\cos \left(\pi \cdot \ell\right)}}}{F}}{F} \]
    6. Applied egg-rr87.7%

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

    if 2e14 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.2%

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

Alternative 4: 98.4% accurate, 0.9× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{-135}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\frac{\pi \cdot l\_m}{F}}{F}\\ \mathbf{elif}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\tan \left(\pi \cdot l\_m\right)}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 2e-135)
    (- (* PI l_m) (/ (/ (* PI l_m) F) F))
    (if (<= (* PI l_m) 2e+14)
      (- (* PI l_m) (/ (tan (* PI l_m)) (* F F)))
      (* PI l_m)))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 2e-135) {
		tmp = (((double) M_PI) * l_m) - (((((double) M_PI) * l_m) / F) / F);
	} else if ((((double) M_PI) * l_m) <= 2e+14) {
		tmp = (((double) M_PI) * l_m) - (tan((((double) M_PI) * l_m)) / (F * F));
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 2e-135) {
		tmp = (Math.PI * l_m) - (((Math.PI * l_m) / F) / F);
	} else if ((Math.PI * l_m) <= 2e+14) {
		tmp = (Math.PI * l_m) - (Math.tan((Math.PI * l_m)) / (F * F));
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 2e-135:
		tmp = (math.pi * l_m) - (((math.pi * l_m) / F) / F)
	elif (math.pi * l_m) <= 2e+14:
		tmp = (math.pi * l_m) - (math.tan((math.pi * l_m)) / (F * F))
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 2e-135)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(pi * l_m) / F) / F));
	elseif (Float64(pi * l_m) <= 2e+14)
		tmp = Float64(Float64(pi * l_m) - Float64(tan(Float64(pi * l_m)) / Float64(F * F)));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 2e-135)
		tmp = (pi * l_m) - (((pi * l_m) / F) / F);
	elseif ((pi * l_m) <= 2e+14)
		tmp = (pi * l_m) - (tan((pi * l_m)) / (F * F));
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e-135], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(Pi * l$95$m), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+14], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{-135}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\pi \cdot l\_m}{F}}{F}\\

\mathbf{elif}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\tan \left(\pi \cdot l\_m\right)}{F \cdot F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


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

    1. Initial program 78.8%

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

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

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

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

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

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

    if 2.0000000000000001e-135 < (*.f64 (PI.f64) l) < 2e14

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot F}} \]
      5. *-rgt-identity99.5%

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

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

    if 2e14 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 2 \cdot 10^{-135}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 2e+14)
    (- (* PI l_m) (/ (/ (tan (* PI l_m)) F) F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 2e+14) {
		tmp = (((double) M_PI) * l_m) - ((tan((((double) M_PI) * l_m)) / F) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 2e+14) {
		tmp = (Math.PI * l_m) - ((Math.tan((Math.PI * l_m)) / F) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 2e+14:
		tmp = (math.pi * l_m) - ((math.tan((math.pi * l_m)) / F) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 2e+14)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(tan(Float64(pi * l_m)) / F) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 2e+14)
		tmp = (pi * l_m) - ((tan((pi * l_m)) / F) / F);
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 2e+14], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 2e14

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

    if 2e14 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.2%

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

Alternative 6: 98.7% accurate, 6.3× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\ \;\;\;\;\pi \cdot l\_m - \frac{\frac{\pi \cdot l\_m}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 500000000000.0)
    (- (* PI l_m) (/ (/ (* PI l_m) F) F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 500000000000.0) {
		tmp = (((double) M_PI) * l_m) - (((((double) M_PI) * l_m) / F) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 500000000000.0) {
		tmp = (Math.PI * l_m) - (((Math.PI * l_m) / F) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 500000000000.0:
		tmp = (math.pi * l_m) - (((math.pi * l_m) / F) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 500000000000.0)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(pi * l_m) / F) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 500000000000.0)
		tmp = (pi * l_m) - (((pi * l_m) / F) / F);
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 500000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(Pi * l$95$m), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{\pi \cdot l\_m}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 5e11

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

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

    if 5e11 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 500000000000:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.7% accurate, 6.3× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\ \;\;\;\;\pi \cdot l\_m - \frac{l\_m \cdot \frac{\pi}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 500000000000.0)
    (- (* PI l_m) (/ (* l_m (/ PI F)) F))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 500000000000.0) {
		tmp = (((double) M_PI) * l_m) - ((l_m * (((double) M_PI) / F)) / F);
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 500000000000.0) {
		tmp = (Math.PI * l_m) - ((l_m * (Math.PI / F)) / F);
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 500000000000.0:
		tmp = (math.pi * l_m) - ((l_m * (math.pi / F)) / F)
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 500000000000.0)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(l_m * Float64(pi / F)) / F));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 500000000000.0)
		tmp = (pi * l_m) - ((l_m * (pi / F)) / F);
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 500000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(l$95$m * N[(Pi / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\
\;\;\;\;\pi \cdot l\_m - \frac{l\_m \cdot \frac{\pi}{F}}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 5e11

    1. Initial program 81.6%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. 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. *-un-lft-identity82.1%

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

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\ell \cdot \frac{\pi}{F}}}{F} \]
    7. Simplified82.8%

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

    if 5e11 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 500000000000:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell \cdot \frac{\pi}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.7% accurate, 6.3× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\ \;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m\\ \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (*
  l_s
  (if (<= (* PI l_m) 500000000000.0)
    (- (* PI l_m) (* (/ PI F) (/ l_m F)))
    (* PI l_m))))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	double tmp;
	if ((((double) M_PI) * l_m) <= 500000000000.0) {
		tmp = (((double) M_PI) * l_m) - ((((double) M_PI) / F) * (l_m / F));
	} else {
		tmp = ((double) M_PI) * l_m;
	}
	return l_s * tmp;
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	double tmp;
	if ((Math.PI * l_m) <= 500000000000.0) {
		tmp = (Math.PI * l_m) - ((Math.PI / F) * (l_m / F));
	} else {
		tmp = Math.PI * l_m;
	}
	return l_s * tmp;
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	tmp = 0
	if (math.pi * l_m) <= 500000000000.0:
		tmp = (math.pi * l_m) - ((math.pi / F) * (l_m / F))
	else:
		tmp = math.pi * l_m
	return l_s * tmp
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	tmp = 0.0
	if (Float64(pi * l_m) <= 500000000000.0)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi / F) * Float64(l_m / F)));
	else
		tmp = Float64(pi * l_m);
	end
	return Float64(l_s * tmp)
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp_2 = code(l_s, F, l_m)
	tmp = 0.0;
	if ((pi * l_m) <= 500000000000.0)
		tmp = (pi * l_m) - ((pi / F) * (l_m / F));
	else
		tmp = pi * l_m;
	end
	tmp_2 = l_s * tmp;
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * If[LessEqual[N[(Pi * l$95$m), $MachinePrecision], 500000000000.0], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(Pi * l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;\pi \cdot l\_m \leq 500000000000:\\
\;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{F}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 5e11

    1. Initial program 81.6%

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

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

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

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

        \[\leadsto \pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot F}} \]
      5. *-rgt-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}} \]
    4. Add Preprocessing
    5. Taylor expanded in l around 0 77.3%

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

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

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

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

    if 5e11 < (*.f64 (PI.f64) l)

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
      2. associate-/l*49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
      3. distribute-rgt-neg-in49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
      4. mul-1-neg49.0%

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
      6. *-commutative49.0%

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
      9. distribute-neg-frac49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
      10. unpow-149.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
      11. exp-to-pow27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
      12. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
      13. exp-prod27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
      14. *-commutative27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
      15. associate-*l*27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
      16. metadata-eval27.3%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
      17. exp-to-pow49.0%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
    7. Simplified49.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
    8. Taylor expanded in F around inf 99.6%

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 500000000000:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 74.4% accurate, 37.7× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \left(\pi \cdot l\_m\right) \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m) :precision binary64 (* l_s (* PI l_m)))
l\_m = fabs(l);
l\_s = copysign(1.0, l);
double code(double l_s, double F, double l_m) {
	return l_s * (((double) M_PI) * l_m);
}
l\_m = Math.abs(l);
l\_s = Math.copySign(1.0, l);
public static double code(double l_s, double F, double l_m) {
	return l_s * (Math.PI * l_m);
}
l\_m = math.fabs(l)
l\_s = math.copysign(1.0, l)
def code(l_s, F, l_m):
	return l_s * (math.pi * l_m)
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(pi * l_m))
end
l\_m = abs(l);
l\_s = sign(l) * abs(1.0);
function tmp = code(l_s, F, l_m)
	tmp = l_s * (pi * l_m);
end
l\_m = N[Abs[l], $MachinePrecision]
l\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[l$95$s_, F_, l$95$m_] := N[(l$95$s * N[(Pi * l$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
l\_s \cdot \left(\pi \cdot l\_m\right)
\end{array}
Derivation
  1. Initial program 77.5%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{F \cdot \left(-F\right)}}\right) \]
    8. *-lft-identity77.9%

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

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

    \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
  6. Step-by-step derivation
    1. mul-1-neg71.2%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{-\frac{\ell \cdot \pi}{{F}^{2}}}\right) \]
    2. associate-/l*70.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\ell \cdot \frac{\pi}{{F}^{2}}}\right) \]
    3. distribute-rgt-neg-in70.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(-\frac{\pi}{{F}^{2}}\right)}\right) \]
    4. mul-1-neg70.8%

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \color{blue}{\frac{-1 \cdot \pi}{{F}^{2}}}\right) \]
    6. *-commutative70.8%

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

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

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \frac{\color{blue}{-1}}{{F}^{2}}\right)\right) \]
    9. distribute-neg-frac70.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \color{blue}{\left(-\frac{1}{{F}^{2}}\right)}\right)\right) \]
    10. unpow-170.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{\left({F}^{2}\right)}^{-1}}\right)\right)\right) \]
    11. exp-to-pow34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\color{blue}{\left(e^{\log F \cdot 2}\right)}}^{-1}\right)\right)\right) \]
    12. *-commutative34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-{\left(e^{\color{blue}{2 \cdot \log F}}\right)}^{-1}\right)\right)\right) \]
    13. exp-prod34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{e^{\left(2 \cdot \log F\right) \cdot -1}}\right)\right)\right) \]
    14. *-commutative34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\left(\log F \cdot 2\right)} \cdot -1}\right)\right)\right) \]
    15. associate-*l*34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\color{blue}{\log F \cdot \left(2 \cdot -1\right)}}\right)\right)\right) \]
    16. metadata-eval34.0%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-e^{\log F \cdot \color{blue}{-2}}\right)\right)\right) \]
    17. exp-to-pow70.8%

      \[\leadsto \mathsf{fma}\left(\pi, \ell, \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{-2}}\right)\right)\right) \]
  7. Simplified70.8%

    \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)}\right) \]
  8. Taylor expanded in F around inf 73.4%

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  9. Final simplification73.4%

    \[\leadsto \pi \cdot \ell \]
  10. Add Preprocessing

Reproduce

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