VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.7% → 99.3%
Time: 3.5s
Alternatives: 6
Speedup: 1.9×

Specification

?
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
(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]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 76.7% accurate, 1.0× speedup?

\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
(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]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)

Alternative 1: 99.3% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 9e14

    1. Initial program 76.7%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
      3. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
      4. mult-flip-revN/A

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      5. lift-*.f64N/A

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      7. lower-/.f64N/A

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}{F} \]
      9. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\pi \cdot \ell\right)}}{F}}{F} \]
      10. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \pi\right)}}{F}}{F} \]
      11. lower-*.f6482.4%

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\ell \cdot \pi\right)}{F}}{F}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\ell \cdot \pi\right)}{F}}}{F} \]
      2. div-flipN/A

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{1}{\frac{F}{\tan \left(\ell \cdot \pi\right)}}}}{F} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{1}{\frac{F}{\tan \left(\ell \cdot \pi\right)}}}}{F} \]
      4. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{\frac{F}{\tan \color{blue}{\left(\ell \cdot \pi\right)}}}}{F} \]
      5. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{\frac{F}{\tan \color{blue}{\left(\pi \cdot \ell\right)}}}}{F} \]
      6. lift-*.f64N/A

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

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{\color{blue}{\frac{F}{\tan \left(\pi \cdot \ell\right)}}}}{F} \]
      8. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{1}{\frac{F}{\tan \color{blue}{\left(\pi \cdot \ell\right)}}}}{F} \]
      9. *-commutativeN/A

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

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

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

    if 9e14 < l

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
      2. lower-PI.f6473.1%

        \[\leadsto \ell \cdot \pi \]
    4. Applied rewrites73.1%

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

Alternative 2: 99.3% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 9e14

    1. Initial program 76.7%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
      3. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
      4. mult-flip-revN/A

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      5. lift-*.f64N/A

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      7. lower-/.f64N/A

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}{F} \]
      9. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\pi \cdot \ell\right)}}{F}}{F} \]
      10. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \pi\right)}}{F}}{F} \]
      11. lower-*.f6482.4%

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

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

    if 9e14 < l

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
      2. lower-PI.f6473.1%

        \[\leadsto \ell \cdot \pi \]
    4. Applied rewrites73.1%

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

Alternative 3: 98.5% accurate, 1.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left|\ell\right| \cdot \pi\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.2e11

    1. Initial program 76.7%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
      3. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
      4. mult-flip-revN/A

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      5. lift-*.f64N/A

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      7. lower-/.f64N/A

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}{F} \]
      9. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\pi \cdot \ell\right)}}{F}}{F} \]
      10. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \pi\right)}}{F}}{F} \]
      11. lower-*.f6482.4%

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

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

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \pi}{F}}}{F} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\ell \cdot \mathsf{PI}\left(\right)}{\color{blue}{F}}}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}{F} \]
      3. lower-PI.f6474.8%

        \[\leadsto \pi \cdot \ell - \frac{\frac{\ell \cdot \pi}{F}}{F} \]
    6. Applied rewrites74.8%

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \pi}{F}}}{F} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\ell \cdot \pi}{\color{blue}{F}}}{F} \]
      2. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\ell \cdot \pi}{F}}{F} \]
      3. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\pi \cdot \ell}{F}}{F} \]
      4. associate-/l*N/A

        \[\leadsto \pi \cdot \ell - \frac{\pi \cdot \color{blue}{\frac{\ell}{F}}}{F} \]
      5. lower-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\pi \cdot \color{blue}{\frac{\ell}{F}}}{F} \]
      6. lower-/.f6474.9%

        \[\leadsto \pi \cdot \ell - \frac{\pi \cdot \frac{\ell}{\color{blue}{F}}}{F} \]
    8. Applied rewrites74.9%

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

    if 7.2e11 < l

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
      2. lower-PI.f6473.1%

        \[\leadsto \ell \cdot \pi \]
    4. Applied rewrites73.1%

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

Alternative 4: 98.4% accurate, 1.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left|\ell\right| \cdot \pi\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.6e11

    1. Initial program 76.7%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\tan \left(\pi \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
      3. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \tan \left(\pi \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
      4. mult-flip-revN/A

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
      5. lift-*.f64N/A

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}} \]
      7. lower-/.f64N/A

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}{F} \]
      9. lift-*.f64N/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\pi \cdot \ell\right)}}{F}}{F} \]
      10. *-commutativeN/A

        \[\leadsto \pi \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \pi\right)}}{F}}{F} \]
      11. lower-*.f6482.4%

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\ell \cdot \pi\right)}{F}}{F}} \]
    4. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\frac{\tan \left(\ell \cdot \pi\right)}{F}}{F}} \]
      2. lift-/.f64N/A

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\ell \cdot \pi\right)}{F}}{F}} \]
      3. sub-to-fractionN/A

        \[\leadsto \color{blue}{\frac{\left(\pi \cdot \ell\right) \cdot F - \frac{\tan \left(\ell \cdot \pi\right)}{F}}{F}} \]
      4. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{F}{\left(\pi \cdot \ell\right) \cdot F - \frac{\tan \left(\ell \cdot \pi\right)}{F}}}} \]
      5. lower-unsound-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{F}{\left(\pi \cdot \ell\right) \cdot F - \frac{\tan \left(\ell \cdot \pi\right)}{F}}}} \]
      6. lower-unsound-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{F}{\left(\pi \cdot \ell\right) \cdot F - \frac{\tan \left(\ell \cdot \pi\right)}{F}}}} \]
      7. lower--.f64N/A

        \[\leadsto \frac{1}{\frac{F}{\color{blue}{\left(\pi \cdot \ell\right) \cdot F - \frac{\tan \left(\ell \cdot \pi\right)}{F}}}} \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{F}{\color{blue}{F \cdot \left(\pi \cdot \ell\right)} - \frac{\tan \left(\ell \cdot \pi\right)}{F}}} \]
      9. lower-*.f6471.7%

        \[\leadsto \frac{1}{\frac{F}{\color{blue}{F \cdot \left(\pi \cdot \ell\right)} - \frac{\tan \left(\ell \cdot \pi\right)}{F}}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{F}{F \cdot \color{blue}{\left(\pi \cdot \ell\right)} - \frac{\tan \left(\ell \cdot \pi\right)}{F}}} \]
      11. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{F}{F \cdot \color{blue}{\left(\ell \cdot \pi\right)} - \frac{\tan \left(\ell \cdot \pi\right)}{F}}} \]
      12. lift-*.f6471.7%

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

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

      \[\leadsto \color{blue}{\frac{\ell \cdot \left(F \cdot \pi - \frac{\pi}{F}\right)}{F}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F}\right)}{\color{blue}{F}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F}\right)}{F} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F}\right)}{F} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F}\right)}{F} \]
      5. lower-PI.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \pi - \frac{\mathsf{PI}\left(\right)}{F}\right)}{F} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\ell \cdot \left(F \cdot \pi - \frac{\mathsf{PI}\left(\right)}{F}\right)}{F} \]
      7. lower-PI.f6464.2%

        \[\leadsto \frac{\ell \cdot \left(F \cdot \pi - \frac{\pi}{F}\right)}{F} \]
    8. Applied rewrites64.2%

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

    if 5.6e11 < l

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
      2. lower-PI.f6473.1%

        \[\leadsto \ell \cdot \pi \]
    4. Applied rewrites73.1%

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

Alternative 5: 84.0% accurate, 0.7× speedup?

\[\begin{array}{l} t_0 := \left|\ell\right| \cdot \pi\\ t_1 := \pi \cdot \left|\ell\right|\\ \mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 - \frac{1}{F \cdot F} \cdot \tan t\_1 \leq -1 \cdot 10^{-280}:\\ \;\;\;\;\frac{-1 \cdot t\_0}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (* (fabs l) PI)) (t_1 (* PI (fabs l))))
   (*
    (copysign 1.0 l)
    (if (<= (- t_1 (* (/ 1.0 (* F F)) (tan t_1))) -1e-280)
      (/ (* -1.0 t_0) (* F F))
      t_0))))
double code(double F, double l) {
	double t_0 = fabs(l) * ((double) M_PI);
	double t_1 = ((double) M_PI) * fabs(l);
	double tmp;
	if ((t_1 - ((1.0 / (F * F)) * tan(t_1))) <= -1e-280) {
		tmp = (-1.0 * t_0) / (F * F);
	} else {
		tmp = t_0;
	}
	return copysign(1.0, l) * tmp;
}
public static double code(double F, double l) {
	double t_0 = Math.abs(l) * Math.PI;
	double t_1 = Math.PI * Math.abs(l);
	double tmp;
	if ((t_1 - ((1.0 / (F * F)) * Math.tan(t_1))) <= -1e-280) {
		tmp = (-1.0 * t_0) / (F * F);
	} else {
		tmp = t_0;
	}
	return Math.copySign(1.0, l) * tmp;
}
def code(F, l):
	t_0 = math.fabs(l) * math.pi
	t_1 = math.pi * math.fabs(l)
	tmp = 0
	if (t_1 - ((1.0 / (F * F)) * math.tan(t_1))) <= -1e-280:
		tmp = (-1.0 * t_0) / (F * F)
	else:
		tmp = t_0
	return math.copysign(1.0, l) * tmp
function code(F, l)
	t_0 = Float64(abs(l) * pi)
	t_1 = Float64(pi * abs(l))
	tmp = 0.0
	if (Float64(t_1 - Float64(Float64(1.0 / Float64(F * F)) * tan(t_1))) <= -1e-280)
		tmp = Float64(Float64(-1.0 * t_0) / Float64(F * F));
	else
		tmp = t_0;
	end
	return Float64(copysign(1.0, l) * tmp)
end
function tmp_2 = code(F, l)
	t_0 = abs(l) * pi;
	t_1 = pi * abs(l);
	tmp = 0.0;
	if ((t_1 - ((1.0 / (F * F)) * tan(t_1))) <= -1e-280)
		tmp = (-1.0 * t_0) / (F * F);
	else
		tmp = t_0;
	end
	tmp_2 = (sign(l) * abs(1.0)) * tmp;
end
code[F_, l_] := Block[{t$95$0 = N[(N[Abs[l], $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[Abs[l], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[l]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 - N[(N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-280], N[(N[(-1.0 * t$95$0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|\ell\right| \cdot \pi\\
t_1 := \pi \cdot \left|\ell\right|\\
\mathsf{copysign}\left(1, \ell\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 - \frac{1}{F \cdot F} \cdot \tan t\_1 \leq -1 \cdot 10^{-280}:\\
\;\;\;\;\frac{-1 \cdot t\_0}{F \cdot F}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -9.9999999999999996e-281

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)}} \]
      2. lower-/.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)}} \]
      3. lower-sin.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{{F}^{2}} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \]
      4. lower-*.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{{\color{blue}{F}}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \]
      5. lower-PI.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \]
      6. lower-*.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \color{blue}{\cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)}} \]
      7. lower-pow.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}} \]
      8. lower-cos.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \]
      9. lower-*.f64N/A

        \[\leadsto -1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \]
      10. lower-PI.f6423.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}} \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}\right) \]
      3. lift-/.f64N/A

        \[\leadsto \mathsf{neg}\left(\frac{\sin \left(\ell \cdot \pi\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}\right) \]
      4. distribute-neg-fracN/A

        \[\leadsto \frac{\mathsf{neg}\left(\sin \left(\ell \cdot \pi\right)\right)}{\color{blue}{{F}^{2} \cdot \cos \left(\ell \cdot \pi\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\sin \left(\ell \cdot \pi\right)\right)}{{F}^{2} \cdot \color{blue}{\cos \left(\ell \cdot \pi\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(\sin \left(\ell \cdot \pi\right)\right)}{\cos \left(\ell \cdot \pi\right) \cdot \color{blue}{{F}^{2}}} \]
      7. associate-/r*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\sin \left(\ell \cdot \pi\right)\right)}{\cos \left(\ell \cdot \pi\right)}}{\color{blue}{{F}^{2}}} \]
      8. distribute-neg-fracN/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{\sin \left(\ell \cdot \pi\right)}{\cos \left(\ell \cdot \pi\right)}\right)}{{\color{blue}{F}}^{2}} \]
      9. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{\sin \left(\ell \cdot \pi\right)}{\cos \left(\ell \cdot \pi\right)}\right)}{{F}^{2}} \]
      10. lift-cos.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{\sin \left(\ell \cdot \pi\right)}{\cos \left(\ell \cdot \pi\right)}\right)}{{F}^{2}} \]
      11. tan-quotN/A

        \[\leadsto \frac{\mathsf{neg}\left(\tan \left(\ell \cdot \pi\right)\right)}{{F}^{2}} \]
      12. lift-tan.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\tan \left(\ell \cdot \pi\right)\right)}{{F}^{2}} \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\tan \left(\ell \cdot \pi\right)\right)}{\color{blue}{{F}^{2}}} \]
    6. Applied rewrites23.4%

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

      \[\leadsto \frac{-1 \cdot \left(\ell \cdot \pi\right)}{\color{blue}{F} \cdot F} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-1 \cdot \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F \cdot F} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{-1 \cdot \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F \cdot F} \]
      3. lower-PI.f6421.8%

        \[\leadsto \frac{-1 \cdot \left(\ell \cdot \pi\right)}{F \cdot F} \]
    9. Applied rewrites21.8%

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

    if -9.9999999999999996e-281 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l))))

    1. Initial program 76.7%

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
      2. lower-PI.f6473.1%

        \[\leadsto \ell \cdot \pi \]
    4. Applied rewrites73.1%

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

Alternative 6: 73.1% accurate, 13.6× speedup?

\[\ell \cdot \pi \]
(FPCore (F l) :precision binary64 (* l PI))
double code(double F, double l) {
	return l * ((double) M_PI);
}
public static double code(double F, double l) {
	return l * Math.PI;
}
def code(F, l):
	return l * math.pi
function code(F, l)
	return Float64(l * pi)
end
function tmp = code(F, l)
	tmp = l * pi;
end
code[F_, l_] := N[(l * Pi), $MachinePrecision]
\ell \cdot \pi
Derivation
  1. Initial program 76.7%

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

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \ell \cdot \color{blue}{\mathsf{PI}\left(\right)} \]
    2. lower-PI.f6473.1%

      \[\leadsto \ell \cdot \pi \]
  4. Applied rewrites73.1%

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  5. Add Preprocessing

Reproduce

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