VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.2% → 98.9%
Time: 37.2s
Alternatives: 8
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 8 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.2% 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: 98.9% 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 500000000:\\ \;\;\;\;\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) 500000000.0)
    (+ (* 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) <= 500000000.0) {
		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) <= 500000000.0) {
		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) <= 500000000.0:
		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) <= 500000000.0)
		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], 500000000.0], 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 500000000:\\
\;\;\;\;\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) < 5e8

    1. Initial program 78.5%

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

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

        \[\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 5e8 < (*.f64 (PI.f64) l)

    1. Initial program 65.7%

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt65.7%

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

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

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

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

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

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

        \[\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)}} \]
      8. frac-times65.4%

        \[\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)}} \]
      9. sqrt-div65.4%

        \[\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)} \]
      10. metadata-eval65.4%

        \[\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)} \]
      11. sqrt-prod31.5%

        \[\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)} \]
      12. add-sqr-sqrt65.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 500000000:\\ \;\;\;\;\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: 96.8% 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{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{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)) (/ -1.0 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)) * (-1.0 / 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)) * (-1.0 / 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)) * (-1.0 / 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)) * Float64(-1.0 / 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)) * (-1.0 / 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] * N[(-1.0 / 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{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{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 75.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. add-sqr-sqrt75.2%

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

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

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

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

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

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

      \[\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)}} \]
    8. frac-times66.6%

      \[\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)}} \]
    9. sqrt-div66.8%

      \[\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)} \]
    10. metadata-eval66.8%

      \[\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)} \]
    11. sqrt-prod40.0%

      \[\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)} \]
    12. add-sqr-sqrt81.7%

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

    \[\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. Final simplification97.3%

    \[\leadsto \pi \cdot \ell + \frac{\sin \left(\pi \cdot \ell\right) \cdot \frac{-1}{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)} \]
  7. Add Preprocessing

Alternative 3: 97.2% 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 100000000:\\ \;\;\;\;\pi \cdot l\_m - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot l\_m + \frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{F}}{-0.001388888888888889 \cdot \left({\pi}^{6} \cdot \left(F \cdot {l\_m}^{6}\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) 100000000.0)
    (- (* PI l_m) (/ 1.0 (/ F (/ (tan (* PI l_m)) F))))
    (+
     (* PI l_m)
     (/
      (* (sin (* PI l_m)) (/ -1.0 F))
      (* -0.001388888888888889 (* (pow PI 6.0) (* F (pow l_m 6.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) <= 100000000.0) {
		tmp = (((double) M_PI) * l_m) - (1.0 / (F / (tan((((double) M_PI) * l_m)) / F)));
	} else {
		tmp = (((double) M_PI) * l_m) + ((sin((((double) M_PI) * l_m)) * (-1.0 / F)) / (-0.001388888888888889 * (pow(((double) M_PI), 6.0) * (F * pow(l_m, 6.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) <= 100000000.0) {
		tmp = (Math.PI * l_m) - (1.0 / (F / (Math.tan((Math.PI * l_m)) / F)));
	} else {
		tmp = (Math.PI * l_m) + ((Math.sin((Math.PI * l_m)) * (-1.0 / F)) / (-0.001388888888888889 * (Math.pow(Math.PI, 6.0) * (F * Math.pow(l_m, 6.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) <= 100000000.0:
		tmp = (math.pi * l_m) - (1.0 / (F / (math.tan((math.pi * l_m)) / F)))
	else:
		tmp = (math.pi * l_m) + ((math.sin((math.pi * l_m)) * (-1.0 / F)) / (-0.001388888888888889 * (math.pow(math.pi, 6.0) * (F * math.pow(l_m, 6.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) <= 100000000.0)
		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(sin(Float64(pi * l_m)) * Float64(-1.0 / F)) / Float64(-0.001388888888888889 * Float64((pi ^ 6.0) * Float64(F * (l_m ^ 6.0))))));
	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) <= 100000000.0)
		tmp = (pi * l_m) - (1.0 / (F / (tan((pi * l_m)) / F)));
	else
		tmp = (pi * l_m) + ((sin((pi * l_m)) * (-1.0 / F)) / (-0.001388888888888889 * ((pi ^ 6.0) * (F * (l_m ^ 6.0)))));
	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], 100000000.0], 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[Sin[N[(Pi * l$95$m), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / N[(-0.001388888888888889 * N[(N[Power[Pi, 6.0], $MachinePrecision] * N[(F * N[Power[l$95$m, 6.0], $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 100000000:\\
\;\;\;\;\pi \cdot l\_m - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot l\_m\right)}{F}}}\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot l\_m + \frac{\sin \left(\pi \cdot l\_m\right) \cdot \frac{-1}{F}}{-0.001388888888888889 \cdot \left({\pi}^{6} \cdot \left(F \cdot {l\_m}^{6}\right)\right)}\\


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

    1. Initial program 78.4%

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

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

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

        \[\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 1e8 < (*.f64 (PI.f64) l)

    1. Initial program 66.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. add-sqr-sqrt66.2%

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

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

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

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

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

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

        \[\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)}} \]
      8. frac-times64.4%

        \[\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)}} \]
      9. sqrt-div64.4%

        \[\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)} \]
      10. metadata-eval64.4%

        \[\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)} \]
      11. sqrt-prod31.0%

        \[\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)} \]
      12. add-sqr-sqrt66.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-rr66.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.6%

      \[\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. Taylor expanded in l around inf 96.6%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{\color{blue}{-0.001388888888888889 \cdot \left(F \cdot \left({\ell}^{6} \cdot {\pi}^{6}\right)\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*96.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{-0.001388888888888889 \cdot \color{blue}{\left(\left(F \cdot {\ell}^{6}\right) \cdot {\pi}^{6}\right)}} \]
      2. *-commutative96.6%

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{-0.001388888888888889 \cdot \color{blue}{\left({\pi}^{6} \cdot \left(F \cdot {\ell}^{6}\right)\right)}} \]
    8. Simplified96.6%

      \[\leadsto \pi \cdot \ell - \frac{\frac{1}{F} \cdot \sin \left(\pi \cdot \ell\right)}{\color{blue}{-0.001388888888888889 \cdot \left({\pi}^{6} \cdot \left(F \cdot {\ell}^{6}\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.5%

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

Alternative 4: 92.0% 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 75.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. add-sqr-sqrt75.2%

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

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

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

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

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

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

      \[\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)}} \]
    8. frac-times66.6%

      \[\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)}} \]
    9. sqrt-div66.8%

      \[\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)} \]
    10. metadata-eval66.8%

      \[\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)} \]
    11. sqrt-prod40.0%

      \[\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)} \]
    12. add-sqr-sqrt81.7%

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

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

    \[\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. +-commutative92.4%

      \[\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-define92.4%

      \[\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. *-commutative92.4%

      \[\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. unpow292.4%

      \[\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 {\ell}^{2}, 1\right)} \]
    5. unpow292.4%

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

      \[\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. unpow292.4%

      \[\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. *-commutative92.4%

      \[\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. Simplified92.4%

    \[\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 simplification92.4%

    \[\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 5: 81.6% 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^{-68}:\\ \;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{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-68)
    (- (* PI l_m) (* (/ PI F) (/ l_m 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-68) {
		tmp = (((double) M_PI) * l_m) - ((((double) M_PI) / F) * (l_m / 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-68) {
		tmp = (Math.PI * l_m) - ((Math.PI / F) * (l_m / 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-68:
		tmp = (math.pi * l_m) - ((math.pi / F) * (l_m / 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-68)
		tmp = Float64(Float64(pi * l_m) - Float64(Float64(pi / F) * Float64(l_m / 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-68)
		tmp = (pi * l_m) - ((pi / F) * (l_m / 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-68], N[(N[(Pi * l$95$m), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l$95$m / F), $MachinePrecision]), $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^{-68}:\\
\;\;\;\;\pi \cdot l\_m - \frac{\pi}{F} \cdot \frac{l\_m}{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.00000000000000013e-68

    1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000013e-68 < (*.f64 (PI.f64) l)

    1. Initial program 71.8%

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

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

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

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

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

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

      \[\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 simplification77.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq 2 \cdot 10^{-68}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \end{array} \]
  5. 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 \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 75.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/75.4%

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

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

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

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

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

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

Alternative 7: 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 \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 75.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/75.4%

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

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

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

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

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

Alternative 8: 74.2% 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{l\_m}{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) (* (/ PI F) (/ 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) - ((((double) M_PI) / F) * (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) - ((Math.PI / F) * (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) - ((math.pi / F) * (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(Float64(pi / F) * Float64(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) - ((pi / F) * (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[(N[(Pi / F), $MachinePrecision] * N[(l$95$m / 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{\pi}{F} \cdot \frac{l\_m}{F}\right)
\end{array}
Derivation
  1. Initial program 75.2%

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
    2. sqr-neg75.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/75.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-neg75.4%

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

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\tan \left(\pi \cdot \ell\right)}}{F \cdot F} \]
  3. Simplified75.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 67.3%

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

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

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

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

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

Reproduce

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