VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.4% → 99.2%
Time: 53.2s
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: 99.2% accurate, 0.1× 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 10^{+15}:\\ \;\;\;\;\pi \cdot l\_m + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot l\_m\right)}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(-0.001388888888888889 \cdot \left({l\_m}^{2} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{6}\right)\right)\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)}\\ \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) 1e+15)
    (+ (* PI l_m) (/ -1.0 (/ F (/ (tan (* PI l_m)) F))))
    (-
     (* PI l_m)
     (/
      (* (/ 1.0 F) (sin (* PI l_m)))
      (*
       F
       (+
        1.0
        (*
         (pow l_m 2.0)
         (+
          (* -0.5 (pow PI 2.0))
          (*
           (pow l_m 2.0)
           (+
            (*
             -0.001388888888888889
             (* (pow l_m 2.0) (log1p (expm1 (pow PI 6.0)))))
            (* 0.041666666666666664 (pow PI 4.0)))))))))))))
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) <= 1e+15) {
		tmp = (((double) M_PI) * l_m) + (-1.0 / (F / (tan((((double) M_PI) * l_m)) / F)));
	} else {
		tmp = (((double) M_PI) * l_m) - (((1.0 / F) * sin((((double) M_PI) * l_m))) / (F * (1.0 + (pow(l_m, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (pow(l_m, 2.0) * ((-0.001388888888888889 * (pow(l_m, 2.0) * log1p(expm1(pow(((double) M_PI), 6.0))))) + (0.041666666666666664 * pow(((double) M_PI), 4.0)))))))));
	}
	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) <= 1e+15) {
		tmp = (Math.PI * l_m) + (-1.0 / (F / (Math.tan((Math.PI * l_m)) / F)));
	} else {
		tmp = (Math.PI * l_m) - (((1.0 / F) * Math.sin((Math.PI * l_m))) / (F * (1.0 + (Math.pow(l_m, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (Math.pow(l_m, 2.0) * ((-0.001388888888888889 * (Math.pow(l_m, 2.0) * Math.log1p(Math.expm1(Math.pow(Math.PI, 6.0))))) + (0.041666666666666664 * Math.pow(Math.PI, 4.0)))))))));
	}
	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) <= 1e+15:
		tmp = (math.pi * l_m) + (-1.0 / (F / (math.tan((math.pi * l_m)) / F)))
	else:
		tmp = (math.pi * l_m) - (((1.0 / F) * math.sin((math.pi * l_m))) / (F * (1.0 + (math.pow(l_m, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (math.pow(l_m, 2.0) * ((-0.001388888888888889 * (math.pow(l_m, 2.0) * math.log1p(math.expm1(math.pow(math.pi, 6.0))))) + (0.041666666666666664 * math.pow(math.pi, 4.0)))))))))
	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) <= 1e+15)
		tmp = Float64(Float64(pi * l_m) + Float64(-1.0 / Float64(F / Float64(tan(Float64(pi * l_m)) / F))));
	else
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(Float64(1.0 / F) * sin(Float64(pi * l_m))) / Float64(F * Float64(1.0 + Float64((l_m ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64((l_m ^ 2.0) * Float64(Float64(-0.001388888888888889 * Float64((l_m ^ 2.0) * log1p(expm1((pi ^ 6.0))))) + Float64(0.041666666666666664 * (pi ^ 4.0))))))))));
	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], 1e+15], N[(N[(Pi * l$95$m), $MachinePrecision] + N[(-1.0 / N[(F / N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[(1.0 / F), $MachinePrecision] * N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(F * N[(1.0 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(-0.001388888888888889 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Log[1 + N[(Exp[N[Power[Pi, 6.0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 10^{+15}:\\
\;\;\;\;\pi \cdot l\_m + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot l\_m\right)}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(-0.001388888888888889 \cdot \left({l\_m}^{2} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{6}\right)\right)\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)}\\


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

    1. Initial program 78.0%

      \[\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/78.3%

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

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

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

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

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

    if 1e15 < (*.f64 (PI.f64) l)

    1. Initial program 57.2%

      \[\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-/r*57.2%

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

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

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

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sqrt{\frac{1}{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}} \]
      8. sqrt-div57.2%

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sqrt{1}}{\sqrt{F \cdot F}}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
      9. metadata-eval57.2%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{1}}{\sqrt{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
      10. sqrt-prod29.3%

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)}} \]
    6. Step-by-step derivation
      1. log1p-expm1-u99.7%

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{6}\right)\right)}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    7. Applied egg-rr99.7%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{6}\right)\right)}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.0%

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

Alternative 2: 83.6% accurate, 0.1× 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 - \frac{\left|\frac{\sin \left(\pi \cdot l\_m\right)}{F}\right|}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({l\_m}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)}\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)
   (/
    (fabs (/ (sin (* PI l_m)) F))
    (*
     F
     (+
      1.0
      (*
       (pow l_m 2.0)
       (+
        (* -0.5 (pow PI 2.0))
        (*
         (pow l_m 2.0)
         (+
          (* 0.041666666666666664 (pow PI 4.0))
          (* -0.001388888888888889 (* (pow l_m 2.0) (pow PI 6.0)))))))))))))
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) - (fabs((sin((((double) M_PI) * l_m)) / F)) / (F * (1.0 + (pow(l_m, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (pow(l_m, 2.0) * ((0.041666666666666664 * pow(((double) M_PI), 4.0)) + (-0.001388888888888889 * (pow(l_m, 2.0) * pow(((double) M_PI), 6.0)))))))))));
}
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) - (Math.abs((Math.sin((Math.PI * l_m)) / F)) / (F * (1.0 + (Math.pow(l_m, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (Math.pow(l_m, 2.0) * ((0.041666666666666664 * Math.pow(Math.PI, 4.0)) + (-0.001388888888888889 * (Math.pow(l_m, 2.0) * Math.pow(Math.PI, 6.0)))))))))));
}
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) - (math.fabs((math.sin((math.pi * l_m)) / F)) / (F * (1.0 + (math.pow(l_m, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (math.pow(l_m, 2.0) * ((0.041666666666666664 * math.pow(math.pi, 4.0)) + (-0.001388888888888889 * (math.pow(l_m, 2.0) * math.pow(math.pi, 6.0)))))))))))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) - Float64(abs(Float64(sin(Float64(pi * l_m)) / F)) / Float64(F * Float64(1.0 + Float64((l_m ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64((l_m ^ 2.0) * Float64(Float64(0.041666666666666664 * (pi ^ 4.0)) + Float64(-0.001388888888888889 * Float64((l_m ^ 2.0) * (pi ^ 6.0))))))))))))
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) - (abs((sin((pi * l_m)) / F)) / (F * (1.0 + ((l_m ^ 2.0) * ((-0.5 * (pi ^ 2.0)) + ((l_m ^ 2.0) * ((0.041666666666666664 * (pi ^ 4.0)) + (-0.001388888888888889 * ((l_m ^ 2.0) * (pi ^ 6.0)))))))))));
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[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[Abs[N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]], $MachinePrecision] / N[(F * N[(1.0 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(0.041666666666666664 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-0.001388888888888889 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Power[Pi, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \frac{\left|\frac{\sin \left(\pi \cdot l\_m\right)}{F}\right|}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({l\_m}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)}\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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*73.3%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\frac{1}{F \cdot F}}}{F} \cdot \color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}} \]
    7. frac-times61.3%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sqrt{\frac{1}{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}} \]
    8. sqrt-div61.5%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sqrt{1}}{\sqrt{F \cdot F}}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    9. metadata-eval61.5%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{1}}{\sqrt{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    10. sqrt-prod36.2%

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

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

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

    \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)}} \]
  6. Step-by-step derivation
    1. add-sqr-sqrt58.0%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\sqrt{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)} \cdot \sqrt{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    2. sqrt-unprod72.3%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\sqrt{\left(\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)\right) \cdot \left(\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)\right)}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    3. pow272.3%

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\color{blue}{{\left(\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)\right)}^{2}}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    4. associate-*l/72.3%

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{{\color{blue}{\left(\frac{1 \cdot \sin \left(\pi \cdot \ell\right)}{F}\right)}}^{2}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    5. *-un-lft-identity72.3%

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{{\left(\frac{\color{blue}{\sin \left(\pi \cdot \ell\right)}}{F}\right)}^{2}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  7. Applied egg-rr72.3%

    \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\sqrt{{\left(\frac{\sin \left(\pi \cdot \ell\right)}{F}\right)}^{2}}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  8. Step-by-step derivation
    1. unpow272.3%

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{F}}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    2. rem-sqrt-square87.3%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\left|\frac{\sin \left(\pi \cdot \ell\right)}{F}\right|}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    3. *-commutative87.3%

      \[\leadsto \pi \cdot \ell - \frac{\left|\frac{\sin \color{blue}{\left(\ell \cdot \pi\right)}}{F}\right|}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  9. Simplified87.3%

    \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\left|\frac{\sin \left(\ell \cdot \pi\right)}{F}\right|}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  10. Final simplification87.3%

    \[\leadsto \pi \cdot \ell - \frac{\left|\frac{\sin \left(\pi \cdot \ell\right)}{F}\right|}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)} \]
  11. Add Preprocessing

Alternative 3: 96.4% accurate, 0.2× 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 - \frac{\frac{\sin \left(\pi \cdot l\_m\right)}{F}}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({l\_m}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)}\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)
   (/
    (/ (sin (* PI l_m)) F)
    (*
     F
     (+
      1.0
      (*
       (pow l_m 2.0)
       (+
        (* -0.5 (pow PI 2.0))
        (*
         (pow l_m 2.0)
         (+
          (* 0.041666666666666664 (pow PI 4.0))
          (* -0.001388888888888889 (* (pow l_m 2.0) (pow PI 6.0)))))))))))))
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) - ((sin((((double) M_PI) * l_m)) / F) / (F * (1.0 + (pow(l_m, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (pow(l_m, 2.0) * ((0.041666666666666664 * pow(((double) M_PI), 4.0)) + (-0.001388888888888889 * (pow(l_m, 2.0) * pow(((double) M_PI), 6.0)))))))))));
}
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) - ((Math.sin((Math.PI * l_m)) / F) / (F * (1.0 + (Math.pow(l_m, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (Math.pow(l_m, 2.0) * ((0.041666666666666664 * Math.pow(Math.PI, 4.0)) + (-0.001388888888888889 * (Math.pow(l_m, 2.0) * Math.pow(Math.PI, 6.0)))))))))));
}
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) - ((math.sin((math.pi * l_m)) / F) / (F * (1.0 + (math.pow(l_m, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (math.pow(l_m, 2.0) * ((0.041666666666666664 * math.pow(math.pi, 4.0)) + (-0.001388888888888889 * (math.pow(l_m, 2.0) * math.pow(math.pi, 6.0)))))))))))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(sin(Float64(pi * l_m)) / F) / Float64(F * Float64(1.0 + Float64((l_m ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64((l_m ^ 2.0) * Float64(Float64(0.041666666666666664 * (pi ^ 4.0)) + Float64(-0.001388888888888889 * Float64((l_m ^ 2.0) * (pi ^ 6.0))))))))))))
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) - ((sin((pi * l_m)) / F) / (F * (1.0 + ((l_m ^ 2.0) * ((-0.5 * (pi ^ 2.0)) + ((l_m ^ 2.0) * ((0.041666666666666664 * (pi ^ 4.0)) + (-0.001388888888888889 * ((l_m ^ 2.0) * (pi ^ 6.0)))))))))));
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[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / N[(F * N[(1.0 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(0.041666666666666664 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-0.001388888888888889 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Power[Pi, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \frac{\frac{\sin \left(\pi \cdot l\_m\right)}{F}}{F \cdot \left(1 + {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {l\_m}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({l\_m}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)}\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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*73.3%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\frac{1}{F \cdot F}}}{F} \cdot \color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}} \]
    7. frac-times61.3%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sqrt{\frac{1}{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}} \]
    8. sqrt-div61.5%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sqrt{1}}{\sqrt{F \cdot F}}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    9. metadata-eval61.5%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{1}}{\sqrt{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    10. sqrt-prod36.2%

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

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

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

    \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)}} \]
  6. Step-by-step derivation
    1. associate-*l/97.3%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{1 \cdot \sin \left(\pi \cdot \ell\right)}{F}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
    2. *-un-lft-identity97.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{\sin \left(\pi \cdot \ell\right)}}{F}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  7. Applied egg-rr97.3%

    \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{F}}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(-0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right) + 0.041666666666666664 \cdot {\pi}^{4}\right)\right)\right)} \]
  8. Final simplification97.3%

    \[\leadsto \pi \cdot \ell - \frac{\frac{\sin \left(\pi \cdot \ell\right)}{F}}{F \cdot \left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + {\ell}^{2} \cdot \left(0.041666666666666664 \cdot {\pi}^{4} + -0.001388888888888889 \cdot \left({\ell}^{2} \cdot {\pi}^{6}\right)\right)\right)\right)} \]
  9. Add Preprocessing

Alternative 4: 95.4% accurate, 0.2× 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 + \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot l\_m\right)}{F \cdot \left(-1 - {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + 0.041666666666666664 \cdot \left({l\_m}^{2} \cdot {\pi}^{4}\right)\right)\right)}\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)
   (/
    (* (/ 1.0 F) (sin (* PI l_m)))
    (*
     F
     (-
      -1.0
      (*
       (pow l_m 2.0)
       (+
        (* -0.5 (pow PI 2.0))
        (* 0.041666666666666664 (* (pow l_m 2.0) (pow PI 4.0)))))))))))
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) + (((1.0 / F) * sin((((double) M_PI) * l_m))) / (F * (-1.0 - (pow(l_m, 2.0) * ((-0.5 * pow(((double) M_PI), 2.0)) + (0.041666666666666664 * (pow(l_m, 2.0) * pow(((double) M_PI), 4.0)))))))));
}
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) + (((1.0 / F) * Math.sin((Math.PI * l_m))) / (F * (-1.0 - (Math.pow(l_m, 2.0) * ((-0.5 * Math.pow(Math.PI, 2.0)) + (0.041666666666666664 * (Math.pow(l_m, 2.0) * Math.pow(Math.PI, 4.0)))))))));
}
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) + (((1.0 / F) * math.sin((math.pi * l_m))) / (F * (-1.0 - (math.pow(l_m, 2.0) * ((-0.5 * math.pow(math.pi, 2.0)) + (0.041666666666666664 * (math.pow(l_m, 2.0) * math.pow(math.pi, 4.0)))))))))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) + Float64(Float64(Float64(1.0 / F) * sin(Float64(pi * l_m))) / Float64(F * Float64(-1.0 - Float64((l_m ^ 2.0) * Float64(Float64(-0.5 * (pi ^ 2.0)) + Float64(0.041666666666666664 * Float64((l_m ^ 2.0) * (pi ^ 4.0))))))))))
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) + (((1.0 / F) * sin((pi * l_m))) / (F * (-1.0 - ((l_m ^ 2.0) * ((-0.5 * (pi ^ 2.0)) + (0.041666666666666664 * ((l_m ^ 2.0) * (pi ^ 4.0)))))))));
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[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(N[(1.0 / F), $MachinePrecision] * N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(F * N[(-1.0 - N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(-0.5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 + \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot l\_m\right)}{F \cdot \left(-1 - {l\_m}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + 0.041666666666666664 \cdot \left({l\_m}^{2} \cdot {\pi}^{4}\right)\right)\right)}\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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*73.3%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\frac{1}{F \cdot F}}}{F} \cdot \color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}} \]
    7. frac-times61.3%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sqrt{\frac{1}{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}} \]
    8. sqrt-div61.5%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sqrt{1}}{\sqrt{F \cdot F}}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    9. metadata-eval61.5%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{1}}{\sqrt{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    10. sqrt-prod36.2%

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

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

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

    \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(1 + {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + 0.041666666666666664 \cdot \left({\ell}^{2} \cdot {\pi}^{4}\right)\right)\right)}} \]
  6. Final simplification95.4%

    \[\leadsto \pi \cdot \ell + \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \left(-1 - {\ell}^{2} \cdot \left(-0.5 \cdot {\pi}^{2} + 0.041666666666666664 \cdot \left({\ell}^{2} \cdot {\pi}^{4}\right)\right)\right)} \]
  7. Add Preprocessing

Alternative 5: 91.9% accurate, 0.4× 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 + \frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{F}}{F \cdot \mathsf{fma}\left(-0.5, {\left(\pi \cdot l\_m\right)}^{2}, 1\right)}\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)
   (/
    (* (sin (* PI l_m)) (/ -1.0 F))
    (* F (fma -0.5 (pow (* PI l_m) 2.0) 1.0))))))
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) + ((sin((((double) M_PI) * l_m)) * (-1.0 / F)) / (F * fma(-0.5, pow((((double) M_PI) * l_m), 2.0), 1.0))));
}
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) + Float64(Float64(sin(Float64(pi * l_m)) * Float64(-1.0 / F)) / Float64(F * fma(-0.5, (Float64(pi * l_m) ^ 2.0), 1.0)))))
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[(N[(Pi * l$95$m), $MachinePrecision] + N[(N[(N[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / N[(F * N[(-0.5 * N[Power[N[(Pi * l$95$m), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 + \frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{F}}{F \cdot \mathsf{fma}\left(-0.5, {\left(\pi \cdot l\_m\right)}^{2}, 1\right)}\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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*73.3%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\sqrt{\frac{1}{F \cdot F}}}{F} \cdot \color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}} \]
    7. frac-times61.3%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sqrt{\frac{1}{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}} \]
    8. sqrt-div61.5%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\sqrt{1}}{\sqrt{F \cdot F}}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    9. metadata-eval61.5%

      \[\leadsto \pi \cdot \ell - \frac{\frac{\color{blue}{1}}{\sqrt{F \cdot F}} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)} \]
    10. sqrt-prod36.2%

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

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

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

    \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(1 + -0.5 \cdot \left({\ell}^{2} \cdot {\pi}^{2}\right)\right)}} \]
  6. Step-by-step derivation
    1. +-commutative90.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\left(-0.5 \cdot \left({\ell}^{2} \cdot {\pi}^{2}\right) + 1\right)}} \]
    2. fma-define90.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\mathsf{fma}\left(-0.5, {\ell}^{2} \cdot {\pi}^{2}, 1\right)}} \]
    3. *-commutative90.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \mathsf{fma}\left(-0.5, \color{blue}{{\pi}^{2} \cdot {\ell}^{2}}, 1\right)} \]
    4. unpow290.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \mathsf{fma}\left(-0.5, {\pi}^{2} \cdot \color{blue}{\left(\ell \cdot \ell\right)}, 1\right)} \]
    5. unpow290.3%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \mathsf{fma}\left(-0.5, \color{blue}{\left(\pi \cdot \pi\right)} \cdot \left(\ell \cdot \ell\right), 1\right)} \]
    6. swap-sqr90.3%

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

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

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \mathsf{fma}\left(-0.5, {\color{blue}{\left(\ell \cdot \pi\right)}}^{2}, 1\right)} \]
  7. Simplified90.3%

    \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{F \cdot \color{blue}{\mathsf{fma}\left(-0.5, {\left(\ell \cdot \pi\right)}^{2}, 1\right)}} \]
  8. Final simplification90.3%

    \[\leadsto \pi \cdot \ell + \frac{\sin \left(\pi \cdot \ell\right) \cdot \frac{-1}{F}}{F \cdot \mathsf{fma}\left(-0.5, {\left(\pi \cdot \ell\right)}^{2}, 1\right)} \]
  9. Add Preprocessing

Alternative 6: 81.9% 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^{-86}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\pi \cdot \frac{l\_m}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\tan \left(\pi \cdot l\_m\right)}{F \cdot F}\\ \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-86)
    (- (* PI l_m) (/ (* PI (/ l_m F)) F))
    (- (* PI l_m) (/ (tan (* PI l_m)) (* F F))))))
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-86) {
		tmp = (((double) M_PI) * l_m) - ((((double) M_PI) * (l_m / F)) / F);
	} else {
		tmp = (((double) M_PI) * l_m) - (tan((((double) M_PI) * l_m)) / (F * F));
	}
	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-86) {
		tmp = (Math.PI * l_m) - ((Math.PI * (l_m / F)) / F);
	} else {
		tmp = (Math.PI * l_m) - (Math.tan((Math.PI * l_m)) / (F * F));
	}
	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-86:
		tmp = (math.pi * l_m) - ((math.pi * (l_m / F)) / F)
	else:
		tmp = (math.pi * l_m) - (math.tan((math.pi * l_m)) / (F * F))
	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-86)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi * Float64(l_m / F)) / F));
	else
		tmp = Float64(Float64(pi * l_m) - Float64(tan(Float64(pi * l_m)) / Float64(F * F)));
	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-86)
		tmp = (pi * l_m) - ((pi * (l_m / F)) / F);
	else
		tmp = (pi * l_m) - (tan((pi * l_m)) / (F * F));
	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-86], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi * N[(l$95$m / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $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^{-86}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\pi \cdot \frac{l\_m}{F}}{F}\\

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


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

    1. Initial program 76.1%

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

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

        \[\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/76.4%

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

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

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

      \[\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 71.4%

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

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

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi \cdot \frac{\ell}{F}}{F}} \]
    9. Applied egg-rr81.0%

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

    if 2.00000000000000017e-86 < (*.f64 (PI.f64) l)

    1. Initial program 66.3%

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

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

        \[\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/66.3%

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

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

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

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

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

Alternative 7: 82.3% accurate, 1.0× 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 + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\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) (/ -1.0 (/ F (/ (tan (* PI l_m)) F))))))
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) + (-1.0 / (F / (tan((((double) M_PI) * l_m)) / F))));
}
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) + (-1.0 / (F / (Math.tan((Math.PI * l_m)) / F))));
}
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) + (-1.0 / (F / (math.tan((math.pi * l_m)) / F))))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) + Float64(-1.0 / Float64(F / Float64(tan(Float64(pi * l_m)) / F)))))
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) + (-1.0 / (F / (tan((pi * l_m)) / F))));
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[(N[(Pi * l$95$m), $MachinePrecision] + N[(-1.0 / N[(F / N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/73.5%

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

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

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

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

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

    \[\leadsto \pi \cdot \ell + \frac{-1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}} \]
  6. Add Preprocessing

Alternative 8: 82.3% accurate, 1.0× 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 - \frac{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}{F}\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) (/ (/ (tan (* PI l_m)) F) F))))
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) - ((tan((((double) M_PI) * l_m)) / F) / F));
}
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) - ((Math.tan((Math.PI * l_m)) / F) / F));
}
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) - ((math.tan((math.pi * l_m)) / F) / F))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(tan(Float64(pi * l_m)) / F) / F)))
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) - ((tan((pi * l_m)) / F) / F));
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[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $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 - \frac{\frac{\tan \left(\pi \cdot l\_m\right)}{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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l/73.5%

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

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

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

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

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

Alternative 9: 74.9% accurate, 10.3× 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 - \frac{l\_m}{F} \cdot \frac{\pi}{F}\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 F) (/ PI F)))))
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 / F) * (((double) M_PI) / F)));
}
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 / F) * (Math.PI / F)));
}
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 / F) * (math.pi / F)))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) - Float64(Float64(l_m / F) * Float64(pi / F))))
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) - ((l_m / F) * (pi / F)));
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[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(l$95$m / F), $MachinePrecision] * N[(Pi / F), $MachinePrecision]), $MachinePrecision]), $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 - \frac{l\_m}{F} \cdot \frac{\pi}{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. associate-*r/73.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-neg73.5%

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

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

    \[\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 67.8%

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

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

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

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{F} \cdot \frac{\ell}{F}} \]
  8. Final simplification74.6%

    \[\leadsto \pi \cdot \ell - \frac{\ell}{F} \cdot \frac{\pi}{F} \]
  9. Add Preprocessing

Alternative 10: 74.8% accurate, 10.3× 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 - \frac{\pi}{F \cdot \frac{F}{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) (/ PI (* F (/ F 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) - (((double) M_PI) / (F * (F / 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) - (Math.PI / (F * (F / 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) - (math.pi / (F * (F / l_m))))
l\_m = abs(l)
l\_s = copysign(1.0, l)
function code(l_s, F, l_m)
	return Float64(l_s * Float64(Float64(pi * l_m) - Float64(pi / Float64(F * Float64(F / 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) - (pi / (F * (F / 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[(N[(Pi * l$95$m), $MachinePrecision] - N[(Pi / N[(F * N[(F / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \frac{\pi}{F \cdot \frac{F}{l\_m}}\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. associate-*r/73.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-neg73.5%

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

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

    \[\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 67.8%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{\frac{F}{\ell}}} \cdot \frac{\pi}{F} \]
    3. frac-times74.6%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1 \cdot \pi}{\frac{F}{\ell} \cdot F}} \]
    4. *-un-lft-identity74.6%

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

    \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
  10. Final simplification74.6%

    \[\leadsto \pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}} \]
  11. Add Preprocessing

Reproduce

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