VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.2% → 99.0%
Time: 15.4s
Alternatives: 7
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 7 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: 99.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{\tan \left(\pi \cdot \ell\right) \cdot \frac{-1}{F}}{F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2e+21) (not (<= (* PI l) 500000.0)))
   (* PI l)
   (+ (* PI l) (/ (* (tan (* PI l)) (/ -1.0 F)) F))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -2e+21) || !((((double) M_PI) * l) <= 500000.0)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = (((double) M_PI) * l) + ((tan((((double) M_PI) * l)) * (-1.0 / F)) / F);
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -2e+21) || !((Math.PI * l) <= 500000.0)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) + ((Math.tan((Math.PI * l)) * (-1.0 / F)) / F);
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -2e+21) or not ((math.pi * l) <= 500000.0):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) + ((math.tan((math.pi * l)) * (-1.0 / F)) / F)
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+21) || !(Float64(pi * l) <= 500000.0))
		tmp = Float64(pi * l);
	else
		tmp = Float64(Float64(pi * l) + Float64(Float64(tan(Float64(pi * l)) * Float64(-1.0 / F)) / F));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -2e+21) || ~(((pi * l) <= 500000.0)))
		tmp = pi * l;
	else
		tmp = (pi * l) + ((tan((pi * l)) * (-1.0 / F)) / F);
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 500000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] + N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\
\;\;\;\;\pi \cdot \ell\\

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


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

    1. Initial program 62.5%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/51.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow251.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv51.4%

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -2e21 < (*.f64 (PI.f64) l) < 5e5

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell + \frac{\tan \left(\pi \cdot \ell\right) \cdot \frac{-1}{F}}{F}\\ \end{array} \]

Alternative 2: 99.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2e+21) (not (<= (* PI l) 500000.0)))
   (* PI l)
   (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -2e+21) || !((((double) M_PI) * l) <= 500000.0)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -2e+21) || !((Math.PI * l) <= 500000.0)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -2e+21) or not ((math.pi * l) <= 500000.0):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) - ((math.tan((math.pi * l)) / F) / F)
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+21) || !(Float64(pi * l) <= 500000.0))
		tmp = Float64(pi * l);
	else
		tmp = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -2e+21) || ~(((pi * l) <= 500000.0)))
		tmp = pi * l;
	else
		tmp = (pi * l) - ((tan((pi * l)) / F) / F);
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 500000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\
\;\;\;\;\pi \cdot \ell\\

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


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

    1. Initial program 62.5%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/51.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow251.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv51.4%

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -2e21 < (*.f64 (PI.f64) l) < 5e5

    1. Initial program 85.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \end{array} \]

Alternative 3: 98.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2e+21) (not (<= (* PI l) 500000.0)))
   (* PI l)
   (- (* PI l) (* (/ PI F) (/ l F)))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -2e+21) || !((((double) M_PI) * l) <= 500000.0)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = (((double) M_PI) * l) - ((((double) M_PI) / F) * (l / F));
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -2e+21) || !((Math.PI * l) <= 500000.0)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) - ((Math.PI / F) * (l / F));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -2e+21) or not ((math.pi * l) <= 500000.0):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) - ((math.pi / F) * (l / F))
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+21) || !(Float64(pi * l) <= 500000.0))
		tmp = Float64(pi * l);
	else
		tmp = Float64(Float64(pi * l) - Float64(Float64(pi / F) * Float64(l / F)));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -2e+21) || ~(((pi * l) <= 500000.0)))
		tmp = pi * l;
	else
		tmp = (pi * l) - ((pi / F) * (l / F));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 500000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(N[(Pi / F), $MachinePrecision] * N[(l / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\


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

    1. Initial program 62.5%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/51.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow251.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv51.4%

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -2e21 < (*.f64 (PI.f64) l) < 5e5

    1. Initial program 85.9%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/86.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow286.6%

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell \cdot \pi}{{F}^{2}}} \]
    6. Step-by-step derivation
      1. unpow286.6%

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

        \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\pi \cdot \ell}}{F \cdot F} \]
      3. times-frac97.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\ \end{array} \]

Alternative 4: 98.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2e+21) (not (<= (* PI l) 500000.0)))
   (* PI l)
   (- (* PI l) (/ PI (* F (/ F l))))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -2e+21) || !((((double) M_PI) * l) <= 500000.0)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = (((double) M_PI) * l) - (((double) M_PI) / (F * (F / l)));
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -2e+21) || !((Math.PI * l) <= 500000.0)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) - (Math.PI / (F * (F / l)));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -2e+21) or not ((math.pi * l) <= 500000.0):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) - (math.pi / (F * (F / l)))
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+21) || !(Float64(pi * l) <= 500000.0))
		tmp = Float64(pi * l);
	else
		tmp = Float64(Float64(pi * l) - Float64(pi / Float64(F * Float64(F / l))));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -2e+21) || ~(((pi * l) <= 500000.0)))
		tmp = pi * l;
	else
		tmp = (pi * l) - (pi / (F * (F / l)));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 500000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] - N[(Pi / N[(F * N[(F / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}}\\


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

    1. Initial program 62.5%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/51.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow251.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv51.4%

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -2e21 < (*.f64 (PI.f64) l) < 5e5

    1. Initial program 85.9%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/86.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow286.6%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F \cdot \frac{F}{\ell}}\\ \end{array} \]

Alternative 5: 92.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \left(\ell - \frac{\ell}{F \cdot F}\right)\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -2e+21) (not (<= (* PI l) 500000.0)))
   (* PI l)
   (* PI (- l (/ l (* F F))))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -2e+21) || !((((double) M_PI) * l) <= 500000.0)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = ((double) M_PI) * (l - (l / (F * F)));
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -2e+21) || !((Math.PI * l) <= 500000.0)) {
		tmp = Math.PI * l;
	} else {
		tmp = Math.PI * (l - (l / (F * F)));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -2e+21) or not ((math.pi * l) <= 500000.0):
		tmp = math.pi * l
	else:
		tmp = math.pi * (l - (l / (F * F)))
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -2e+21) || !(Float64(pi * l) <= 500000.0))
		tmp = Float64(pi * l);
	else
		tmp = Float64(pi * Float64(l - Float64(l / Float64(F * F))));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -2e+21) || ~(((pi * l) <= 500000.0)))
		tmp = pi * l;
	else
		tmp = pi * (l - (l / (F * F)));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 500000.0]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(Pi * N[(l - N[(l / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\
\;\;\;\;\pi \cdot \ell\\

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


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

    1. Initial program 62.5%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/51.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow251.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv51.4%

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -2e21 < (*.f64 (PI.f64) l) < 5e5

    1. Initial program 85.9%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/86.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow286.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \ell \cdot \pi + \left(-\color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi}\right) \]
      3. unpow286.6%

        \[\leadsto \ell \cdot \pi + \left(-\frac{\ell}{\color{blue}{F \cdot F}} \cdot \pi\right) \]
      4. distribute-lft-neg-in86.6%

        \[\leadsto \ell \cdot \pi + \color{blue}{\left(-\frac{\ell}{F \cdot F}\right) \cdot \pi} \]
      5. distribute-rgt-in86.6%

        \[\leadsto \color{blue}{\pi \cdot \left(\ell + \left(-\frac{\ell}{F \cdot F}\right)\right)} \]
      6. sub-neg86.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -2 \cdot 10^{+21} \lor \neg \left(\pi \cdot \ell \leq 500000\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \left(\ell - \frac{\ell}{F \cdot F}\right)\\ \end{array} \]

Alternative 6: 71.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{-129} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-295}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \frac{-\ell}{F \cdot F}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -1e-129) (not (<= (* PI l) 5e-295)))
   (* PI l)
   (* PI (/ (- l) (* F F)))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -1e-129) || !((((double) M_PI) * l) <= 5e-295)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = ((double) M_PI) * (-l / (F * F));
	}
	return tmp;
}
public static double code(double F, double l) {
	double tmp;
	if (((Math.PI * l) <= -1e-129) || !((Math.PI * l) <= 5e-295)) {
		tmp = Math.PI * l;
	} else {
		tmp = Math.PI * (-l / (F * F));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if ((math.pi * l) <= -1e-129) or not ((math.pi * l) <= 5e-295):
		tmp = math.pi * l
	else:
		tmp = math.pi * (-l / (F * F))
	return tmp
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -1e-129) || !(Float64(pi * l) <= 5e-295))
		tmp = Float64(pi * l);
	else
		tmp = Float64(pi * Float64(Float64(-l) / Float64(F * F)));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if (((pi * l) <= -1e-129) || ~(((pi * l) <= 5e-295)))
		tmp = pi * l;
	else
		tmp = pi * (-l / (F * F));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -1e-129], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 5e-295]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(Pi * N[((-l) / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{-129} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-295}\right):\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{else}:\\
\;\;\;\;\pi \cdot \frac{-\ell}{F \cdot F}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < -9.9999999999999993e-130 or 5.00000000000000008e-295 < (*.f64 (PI.f64) l)

    1. Initial program 72.0%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/65.6%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow265.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \pi} \]

    if -9.9999999999999993e-130 < (*.f64 (PI.f64) l) < 5.00000000000000008e-295

    1. Initial program 83.4%

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

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

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
      2. associate-/r/83.4%

        \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
      3. unpow283.4%

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

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

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

        \[\leadsto \pi \cdot \ell - \pi \cdot \color{blue}{\frac{1}{\frac{F \cdot F}{\ell}}} \]
      3. un-div-inv83.3%

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

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

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

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

        \[\leadsto -1 \cdot \frac{\color{blue}{\pi \cdot \ell}}{{F}^{2}} \]
      2. associate-*r/60.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(\pi \cdot \ell\right)}{{F}^{2}}} \]
      3. neg-mul-160.1%

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. distribute-rgt-neg-out60.1%

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

        \[\leadsto \color{blue}{\pi \cdot \frac{-\ell}{{F}^{2}}} \]
      6. unpow260.1%

        \[\leadsto \pi \cdot \frac{-\ell}{\color{blue}{F \cdot F}} \]
    9. Simplified60.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{-129} \lor \neg \left(\pi \cdot \ell \leq 5 \cdot 10^{-295}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \frac{-\ell}{F \cdot F}\\ \end{array} \]

Alternative 7: 74.1% accurate, 3.0× speedup?

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

\\
\pi \cdot \ell
\end{array}
Derivation
  1. Initial program 73.3%

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

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

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{\frac{{F}^{2}}{\pi}}} \]
    2. associate-/r/67.6%

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\ell}{{F}^{2}} \cdot \pi} \]
    3. unpow267.6%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  8. Final simplification77.0%

    \[\leadsto \pi \cdot \ell \]

Reproduce

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