VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.4% → 98.3%
Time: 13.1s
Alternatives: 11
Speedup: 2.7×

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

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

Initial Program: 76.4% accurate, 1.0× speedup?

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

\\
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\end{array}

Alternative 1: 98.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -4 \cdot 10^{+32} \lor \neg \left(\pi \cdot \ell \leq 100\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) -4e+32) (not (<= (* PI l) 100.0)))
   (* PI l)
   (- (* PI l) (/ (/ (tan (* PI l)) F) F))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -4e+32) || !((((double) M_PI) * l) <= 100.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) <= -4e+32) || !((Math.PI * l) <= 100.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) <= -4e+32) or not ((math.pi * l) <= 100.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) <= -4e+32) || !(Float64(pi * l) <= 100.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) <= -4e+32) || ~(((pi * l) <= 100.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], -4e+32], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 100.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 -4 \cdot 10^{+32} \lor \neg \left(\pi \cdot \ell \leq 100\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) < -4.00000000000000021e32 or 100 < (*.f64 (PI.f64) l)

    1. Initial program 63.2%

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
    5. Step-by-step derivation
      1. unpow252.0%

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

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

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

    if -4.00000000000000021e32 < (*.f64 (PI.f64) l) < 100

    1. Initial program 88.7%

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

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

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

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

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

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

Alternative 2: 97.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < -4.00000000000000021e32 or 9.9999999999999998e-17 < (*.f64 (PI.f64) l)

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -4.00000000000000021e32 < (*.f64 (PI.f64) l) < 9.9999999999999998e-17

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 92.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
    5. Step-by-step derivation
      1. unpow287.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \left(\pi + \frac{\pi}{F} \cdot \frac{-1}{F}\right)\\ \end{array} \]

Alternative 4: 92.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -460000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -4.6e11 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -4.6e11 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -460000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \pi \cdot \frac{\ell}{F \cdot F}\\ \end{array} \]

Alternative 5: 98.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\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 (<= l -7200000000000.0) (not (<= l 0.017)))
   (* PI l)
   (- (* PI l) (* (/ PI F) (/ l F)))))
double code(double F, double l) {
	double tmp;
	if ((l <= -7200000000000.0) || !(l <= 0.017)) {
		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 ((l <= -7200000000000.0) || !(l <= 0.017)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) - ((Math.PI / F) * (l / F));
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if (l <= -7200000000000.0) or not (l <= 0.017):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) - ((math.pi / F) * (l / F))
	return tmp
function code(F, l)
	tmp = 0.0
	if ((l <= -7200000000000.0) || !(l <= 0.017))
		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 ((l <= -7200000000000.0) || ~((l <= 0.017)))
		tmp = pi * l;
	else
		tmp = (pi * l) - ((pi / F) * (l / F));
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[Or[LessEqual[l, -7200000000000.0], N[Not[LessEqual[l, 0.017]], $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}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\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 l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
    4. Step-by-step derivation
      1. add-cbrt-cube59.4%

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

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

        \[\leadsto \pi \cdot \ell - \frac{\tan \left({\color{blue}{\left({\left(\pi \cdot \ell\right)}^{3}\right)}}^{0.3333333333333333}\right)}{F \cdot F} \]
      4. pow-to-exp25.9%

        \[\leadsto \pi \cdot \ell - \frac{\tan \left({\color{blue}{\left(e^{\log \left(\pi \cdot \ell\right) \cdot 3}\right)}}^{0.3333333333333333}\right)}{F \cdot F} \]
      5. pow-exp38.0%

        \[\leadsto \pi \cdot \ell - \frac{\tan \color{blue}{\left(e^{\left(\log \left(\pi \cdot \ell\right) \cdot 3\right) \cdot 0.3333333333333333}\right)}}{F \cdot F} \]
    5. Applied egg-rr38.0%

      \[\leadsto \pi \cdot \ell - \frac{\tan \color{blue}{\left(e^{\left(\log \left(\pi \cdot \ell\right) \cdot 3\right) \cdot 0.3333333333333333}\right)}}{F \cdot F} \]
    6. Taylor expanded in l around 0 88.2%

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

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

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

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

      \[\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}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\pi}{F} \cdot \frac{\ell}{F}\\ \end{array} \]

Alternative 6: 98.2% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

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

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \pi}{F}}}{F} \]
    5. Step-by-step derivation
      1. *-un-lft-identity98.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell \cdot \frac{\pi}{F}}{F}\\ \end{array} \]

Alternative 7: 92.4% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
    5. Step-by-step derivation
      1. unpow287.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \left(\pi - \frac{\pi}{F \cdot F}\right)\\ \end{array} \]

Alternative 8: 74.7% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{-18} \lor \neg \left(\ell \leq -4.3 \cdot 10^{-216} \lor \neg \left(\ell \leq -2.45 \cdot 10^{-238}\right) \land \ell \leq 8.5 \cdot 10^{-13}\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -4.0000000000000003e-18 or -4.2999999999999997e-216 < l < -2.4499999999999999e-238 or 8.5000000000000001e-13 < l

    1. Initial program 68.0%

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

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

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

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

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

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

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

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

    if -4.0000000000000003e-18 < l < -4.2999999999999997e-216 or -2.4499999999999999e-238 < l < 8.5000000000000001e-13

    1. Initial program 87.5%

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

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

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

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

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

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

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

        \[\leadsto \ell \cdot \color{blue}{\left(\pi + \left(-\frac{\pi}{F \cdot F}\right)\right)} \]
      2. distribute-lft-in87.5%

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

        \[\leadsto \color{blue}{\pi \cdot \ell} + \ell \cdot \left(-\frac{\pi}{F \cdot F}\right) \]
      4. div-inv87.5%

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

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

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\frac{1}{\color{blue}{{F}^{2}}}\right)\right) \]
      7. pow-flip87.5%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{\left(-2\right)}}\right)\right) \]
      8. metadata-eval87.5%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{\color{blue}{-2}}\right)\right) \]
    8. Applied egg-rr87.5%

      \[\leadsto \color{blue}{\pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutative87.5%

        \[\leadsto \color{blue}{\ell \cdot \pi} + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right) \]
      2. distribute-lft-in87.5%

        \[\leadsto \color{blue}{\ell \cdot \left(\pi + \pi \cdot \left(-{F}^{-2}\right)\right)} \]
      3. distribute-rgt-neg-out87.5%

        \[\leadsto \ell \cdot \left(\pi + \color{blue}{\left(-\pi \cdot {F}^{-2}\right)}\right) \]
      4. sub-neg87.5%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi - \pi \cdot {F}^{-2}\right)} \]
      5. *-rgt-identity87.5%

        \[\leadsto \ell \cdot \left(\color{blue}{\pi \cdot 1} - \pi \cdot {F}^{-2}\right) \]
      6. distribute-lft-out--87.5%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    10. Simplified87.5%

      \[\leadsto \color{blue}{\ell \cdot \left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    11. Taylor expanded in F around 0 54.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{\ell \cdot \pi}{{F}^{2}}} \]
    12. Step-by-step derivation
      1. mul-1-neg54.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4 \cdot 10^{-18} \lor \neg \left(\ell \leq -4.3 \cdot 10^{-216} \lor \neg \left(\ell \leq -2.45 \cdot 10^{-238}\right) \land \ell \leq 8.5 \cdot 10^{-13}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{F} \cdot \frac{-\ell}{F}\\ \end{array} \]

Alternative 9: 92.4% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
    5. Step-by-step derivation
      1. unpow287.8%

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

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

        \[\leadsto \ell \cdot \color{blue}{\left(\pi + \left(-\frac{\pi}{F \cdot F}\right)\right)} \]
      2. distribute-lft-in87.7%

        \[\leadsto \color{blue}{\ell \cdot \pi + \ell \cdot \left(-\frac{\pi}{F \cdot F}\right)} \]
      3. *-commutative87.7%

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

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

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

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\frac{1}{\color{blue}{{F}^{2}}}\right)\right) \]
      7. pow-flip87.7%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{\left(-2\right)}}\right)\right) \]
      8. metadata-eval87.7%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{\color{blue}{-2}}\right)\right) \]
    8. Applied egg-rr87.7%

      \[\leadsto \color{blue}{\pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutative87.7%

        \[\leadsto \color{blue}{\ell \cdot \pi} + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right) \]
      2. distribute-lft-in87.7%

        \[\leadsto \color{blue}{\ell \cdot \left(\pi + \pi \cdot \left(-{F}^{-2}\right)\right)} \]
      3. distribute-rgt-neg-out87.7%

        \[\leadsto \ell \cdot \left(\pi + \color{blue}{\left(-\pi \cdot {F}^{-2}\right)}\right) \]
      4. sub-neg87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi - \pi \cdot {F}^{-2}\right)} \]
      5. *-rgt-identity87.7%

        \[\leadsto \ell \cdot \left(\color{blue}{\pi \cdot 1} - \pi \cdot {F}^{-2}\right) \]
      6. distribute-lft-out--87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    10. Simplified87.7%

      \[\leadsto \color{blue}{\ell \cdot \left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    11. Taylor expanded in l around 0 87.7%

      \[\leadsto \color{blue}{\ell \cdot \left(\left(1 - \frac{1}{{F}^{2}}\right) \cdot \pi\right)} \]
    12. Step-by-step derivation
      1. *-commutative87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi \cdot \left(1 - \frac{1}{{F}^{2}}\right)\right)} \]
      2. /-rgt-identity87.7%

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

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

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

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

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{-1}} \cdot \frac{1}{F}\right)\right) \]
      7. unpow-187.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{-1} \cdot \color{blue}{{F}^{-1}}\right)\right) \]
      8. pow-sqr87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{\left(2 \cdot -1\right)}}\right)\right) \]
      9. metadata-eval87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{\color{blue}{-2}}\right)\right) \]
      10. metadata-eval87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{\color{blue}{\left(2 \cdot -1\right)}}\right)\right) \]
      11. pow-sqr87.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{-1} \cdot {F}^{-1}}\right)\right) \]
      12. unpow-187.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{\frac{1}{F}} \cdot {F}^{-1}\right)\right) \]
      13. unpow-187.6%

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

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

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{\frac{F \cdot F}{1}}}\right)\right) \]
      16. unpow287.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\frac{\color{blue}{{F}^{2}}}{1}}\right)\right) \]
      17. /-rgt-identity87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{{F}^{2}}}\right)\right) \]
      18. unpow287.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{F \cdot F}}\right)\right) \]
    13. Simplified87.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \left(\pi \cdot \left(1 + \frac{-1}{F \cdot F}\right)\right)\\ \end{array} \]

Alternative 10: 92.4% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.2e12 or 0.017000000000000001 < l

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

    if -7.2e12 < l < 0.017000000000000001

    1. Initial program 88.5%

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

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

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

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

      \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
    5. Step-by-step derivation
      1. unpow287.8%

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

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

        \[\leadsto \ell \cdot \color{blue}{\left(\pi + \left(-\frac{\pi}{F \cdot F}\right)\right)} \]
      2. distribute-lft-in87.7%

        \[\leadsto \color{blue}{\ell \cdot \pi + \ell \cdot \left(-\frac{\pi}{F \cdot F}\right)} \]
      3. *-commutative87.7%

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

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

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

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\frac{1}{\color{blue}{{F}^{2}}}\right)\right) \]
      7. pow-flip87.7%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-\color{blue}{{F}^{\left(-2\right)}}\right)\right) \]
      8. metadata-eval87.7%

        \[\leadsto \pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{\color{blue}{-2}}\right)\right) \]
    8. Applied egg-rr87.7%

      \[\leadsto \color{blue}{\pi \cdot \ell + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutative87.7%

        \[\leadsto \color{blue}{\ell \cdot \pi} + \ell \cdot \left(\pi \cdot \left(-{F}^{-2}\right)\right) \]
      2. distribute-lft-in87.7%

        \[\leadsto \color{blue}{\ell \cdot \left(\pi + \pi \cdot \left(-{F}^{-2}\right)\right)} \]
      3. distribute-rgt-neg-out87.7%

        \[\leadsto \ell \cdot \left(\pi + \color{blue}{\left(-\pi \cdot {F}^{-2}\right)}\right) \]
      4. sub-neg87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi - \pi \cdot {F}^{-2}\right)} \]
      5. *-rgt-identity87.7%

        \[\leadsto \ell \cdot \left(\color{blue}{\pi \cdot 1} - \pi \cdot {F}^{-2}\right) \]
      6. distribute-lft-out--87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    10. Simplified87.7%

      \[\leadsto \color{blue}{\ell \cdot \left(\pi \cdot \left(1 - {F}^{-2}\right)\right)} \]
    11. Taylor expanded in l around 0 87.7%

      \[\leadsto \color{blue}{\ell \cdot \left(\left(1 - \frac{1}{{F}^{2}}\right) \cdot \pi\right)} \]
    12. Step-by-step derivation
      1. *-commutative87.7%

        \[\leadsto \ell \cdot \color{blue}{\left(\pi \cdot \left(1 - \frac{1}{{F}^{2}}\right)\right)} \]
      2. /-rgt-identity87.7%

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

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

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

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

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{-1}} \cdot \frac{1}{F}\right)\right) \]
      7. unpow-187.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{-1} \cdot \color{blue}{{F}^{-1}}\right)\right) \]
      8. pow-sqr87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{\left(2 \cdot -1\right)}}\right)\right) \]
      9. metadata-eval87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{\color{blue}{-2}}\right)\right) \]
      10. metadata-eval87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - {F}^{\color{blue}{\left(2 \cdot -1\right)}}\right)\right) \]
      11. pow-sqr87.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{{F}^{-1} \cdot {F}^{-1}}\right)\right) \]
      12. unpow-187.6%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \color{blue}{\frac{1}{F}} \cdot {F}^{-1}\right)\right) \]
      13. unpow-187.6%

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

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

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{\frac{F \cdot F}{1}}}\right)\right) \]
      16. unpow287.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\frac{\color{blue}{{F}^{2}}}{1}}\right)\right) \]
      17. /-rgt-identity87.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{{F}^{2}}}\right)\right) \]
      18. unpow287.7%

        \[\leadsto \ell \cdot \left(\pi \cdot \left(1 - \frac{1}{\color{blue}{F \cdot F}}\right)\right) \]
    13. Simplified87.7%

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

      \[\leadsto \color{blue}{\ell \cdot \left(\left(1 - \frac{1}{{F}^{2}}\right) \cdot \pi\right)} \]
    15. Step-by-step derivation
      1. *-commutative87.7%

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

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

        \[\leadsto \color{blue}{\left(1 + \left(-\frac{1}{{F}^{2}}\right)\right)} \cdot \left(\pi \cdot \ell\right) \]
      4. distribute-neg-frac87.8%

        \[\leadsto \left(1 + \color{blue}{\frac{-1}{{F}^{2}}}\right) \cdot \left(\pi \cdot \ell\right) \]
      5. metadata-eval87.8%

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

        \[\leadsto \left(1 + \frac{-1}{\color{blue}{F \cdot F}}\right) \cdot \left(\pi \cdot \ell\right) \]
      7. *-commutative87.8%

        \[\leadsto \left(1 + \frac{-1}{F \cdot F}\right) \cdot \color{blue}{\left(\ell \cdot \pi\right)} \]
    16. Simplified87.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7200000000000 \lor \neg \left(\ell \leq 0.017\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\left(\pi \cdot \ell\right) \cdot \left(1 + \frac{-1}{F \cdot F}\right)\\ \end{array} \]

Alternative 11: 73.4% 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 76.9%

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

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

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

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

    \[\leadsto \color{blue}{\ell \cdot \left(\pi - \frac{\pi}{{F}^{2}}\right)} \]
  5. Step-by-step derivation
    1. unpow270.9%

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

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

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  8. Final simplification68.3%

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

Reproduce

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