VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.1% → 98.5%
Time: 14.3s
Alternatives: 8
Speedup: 0.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 8 alternatives:

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

Initial Program: 76.1% 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.5% accurate, 0.6× speedup?

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

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

    if -5e19 < (*.f64 (PI.f64) l) < 1.00000000000000005e-4

    1. Initial program 91.6%

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

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

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

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

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

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

Alternative 2: 73.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -4 \cdot 10^{-37}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq 4 \cdot 10^{-298}:\\ \;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-116} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{-45}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi \cdot \ell}{F \cdot \left(-F\right)}\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (<= (* PI l) -4e-37)
   (* PI l)
   (if (<= (* PI l) 4e-298)
     (/ (/ l (/ F PI)) (- F))
     (if (or (<= (* PI l) 5e-116) (not (<= (* PI l) 2e-45)))
       (* PI l)
       (/ (* PI l) (* F (- F)))))))
double code(double F, double l) {
	double tmp;
	if ((((double) M_PI) * l) <= -4e-37) {
		tmp = ((double) M_PI) * l;
	} else if ((((double) M_PI) * l) <= 4e-298) {
		tmp = (l / (F / ((double) M_PI))) / -F;
	} else if (((((double) M_PI) * l) <= 5e-116) || !((((double) M_PI) * l) <= 2e-45)) {
		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) <= -4e-37) {
		tmp = Math.PI * l;
	} else if ((Math.PI * l) <= 4e-298) {
		tmp = (l / (F / Math.PI)) / -F;
	} else if (((Math.PI * l) <= 5e-116) || !((Math.PI * l) <= 2e-45)) {
		tmp = Math.PI * l;
	} else {
		tmp = (Math.PI * l) / (F * -F);
	}
	return tmp;
}
def code(F, l):
	tmp = 0
	if (math.pi * l) <= -4e-37:
		tmp = math.pi * l
	elif (math.pi * l) <= 4e-298:
		tmp = (l / (F / math.pi)) / -F
	elif ((math.pi * l) <= 5e-116) or not ((math.pi * l) <= 2e-45):
		tmp = math.pi * l
	else:
		tmp = (math.pi * l) / (F * -F)
	return tmp
function code(F, l)
	tmp = 0.0
	if (Float64(pi * l) <= -4e-37)
		tmp = Float64(pi * l);
	elseif (Float64(pi * l) <= 4e-298)
		tmp = Float64(Float64(l / Float64(F / pi)) / Float64(-F));
	elseif ((Float64(pi * l) <= 5e-116) || !(Float64(pi * l) <= 2e-45))
		tmp = Float64(pi * l);
	else
		tmp = Float64(Float64(pi * l) / Float64(F * Float64(-F)));
	end
	return tmp
end
function tmp_2 = code(F, l)
	tmp = 0.0;
	if ((pi * l) <= -4e-37)
		tmp = pi * l;
	elseif ((pi * l) <= 4e-298)
		tmp = (l / (F / pi)) / -F;
	elseif (((pi * l) <= 5e-116) || ~(((pi * l) <= 2e-45)))
		tmp = pi * l;
	else
		tmp = (pi * l) / (F * -F);
	end
	tmp_2 = tmp;
end
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], -4e-37], N[(Pi * l), $MachinePrecision], If[LessEqual[N[(Pi * l), $MachinePrecision], 4e-298], N[(N[(l / N[(F / Pi), $MachinePrecision]), $MachinePrecision] / (-F)), $MachinePrecision], If[Or[LessEqual[N[(Pi * l), $MachinePrecision], 5e-116], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 2e-45]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(N[(Pi * l), $MachinePrecision] / N[(F * (-F)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -4 \cdot 10^{-37}:\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{elif}\;\pi \cdot \ell \leq 4 \cdot 10^{-298}:\\
\;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-116} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{-45}\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -4.00000000000000027e-37 or 3.99999999999999965e-298 < (*.f64 (PI.f64) l) < 5.0000000000000003e-116 or 1.99999999999999997e-45 < (*.f64 (PI.f64) l)

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

    if -4.00000000000000027e-37 < (*.f64 (PI.f64) l) < 3.99999999999999965e-298

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. *-commutative48.9%

        \[\leadsto \frac{-\color{blue}{\ell \cdot \pi}}{{F}^{2}} \]
      5. distribute-rgt-neg-in48.9%

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

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

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

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

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

        \[\leadsto \frac{-\pi}{\color{blue}{\frac{F}{\ell} \cdot F}} \]
      5. distribute-neg-frac57.9%

        \[\leadsto \color{blue}{-\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
      6. associate-/r*57.9%

        \[\leadsto -\color{blue}{\frac{\frac{\pi}{\frac{F}{\ell}}}{F}} \]
      7. un-div-inv57.9%

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

        \[\leadsto -\color{blue}{\frac{1}{F} \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      9. distribute-lft-neg-in57.9%

        \[\leadsto \color{blue}{\left(-\frac{1}{F}\right) \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      10. distribute-neg-frac57.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)} \]
    10. Step-by-step derivation
      1. *-commutative57.9%

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

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

        \[\leadsto \left(\pi \cdot \frac{\ell}{F}\right) \cdot \frac{\color{blue}{1}}{-F} \]
      4. un-div-inv57.9%

        \[\leadsto \color{blue}{\frac{\pi \cdot \frac{\ell}{F}}{-F}} \]
      5. associate-*r/58.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{\ell}{\frac{F}{\pi}}}}{-F} \]
    11. Applied egg-rr57.9%

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

    if 5.0000000000000003e-116 < (*.f64 (PI.f64) l) < 1.99999999999999997e-45

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. *-commutative99.9%

        \[\leadsto \frac{-\color{blue}{\ell \cdot \pi}}{{F}^{2}} \]
      5. distribute-rgt-neg-in99.9%

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

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

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

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

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

        \[\leadsto \frac{-\pi}{\color{blue}{\frac{F}{\ell} \cdot F}} \]
      5. distribute-neg-frac99.4%

        \[\leadsto \color{blue}{-\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
      6. associate-/r*99.3%

        \[\leadsto -\color{blue}{\frac{\frac{\pi}{\frac{F}{\ell}}}{F}} \]
      7. un-div-inv99.7%

        \[\leadsto -\color{blue}{\frac{\pi}{\frac{F}{\ell}} \cdot \frac{1}{F}} \]
      8. *-commutative99.7%

        \[\leadsto -\color{blue}{\frac{1}{F} \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      9. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{-1}{F}} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      11. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-1}}{F} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      12. div-inv99.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -4 \cdot 10^{-37}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\pi \cdot \ell \leq 4 \cdot 10^{-298}:\\ \;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 5 \cdot 10^{-116} \lor \neg \left(\pi \cdot \ell \leq 2 \cdot 10^{-45}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi \cdot \ell}{F \cdot \left(-F\right)}\\ \end{array} \]

Alternative 3: 98.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -5 \cdot 10^{+19} \lor \neg \left(\pi \cdot \ell \leq 0.0001\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\pi, \ell, -\frac{\frac{\pi \cdot \ell}{F}}{F}\right)\\ \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (if (or (<= (* PI l) -5e+19) (not (<= (* PI l) 0.0001)))
   (* PI l)
   (fma PI l (- (/ (/ (* PI l) F) F)))))
double code(double F, double l) {
	double tmp;
	if (((((double) M_PI) * l) <= -5e+19) || !((((double) M_PI) * l) <= 0.0001)) {
		tmp = ((double) M_PI) * l;
	} else {
		tmp = fma(((double) M_PI), l, -(((((double) M_PI) * l) / F) / F));
	}
	return tmp;
}
function code(F, l)
	tmp = 0.0
	if ((Float64(pi * l) <= -5e+19) || !(Float64(pi * l) <= 0.0001))
		tmp = Float64(pi * l);
	else
		tmp = fma(pi, l, Float64(-Float64(Float64(Float64(pi * l) / F) / F)));
	end
	return tmp
end
code[F_, l_] := If[Or[LessEqual[N[(Pi * l), $MachinePrecision], -5e+19], N[Not[LessEqual[N[(Pi * l), $MachinePrecision], 0.0001]], $MachinePrecision]], N[(Pi * l), $MachinePrecision], N[(Pi * l + (-N[(N[(N[(Pi * l), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

    if -5e19 < (*.f64 (PI.f64) l) < 1.00000000000000005e-4

    1. Initial program 91.6%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\pi, \ell, -\frac{1}{\left(-F\right) \cdot \left(-F\right)} \cdot \tan \left(\pi \cdot \ell\right)\right)} \]
      5. associate-*l/92.1%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\frac{1 \cdot \tan \left(\pi \cdot \ell\right)}{\left(-F\right) \cdot \left(-F\right)}}\right) \]
      6. times-frac99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, -\color{blue}{\frac{1}{-F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}}\right) \]
      7. distribute-lft-neg-in99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\left(-\frac{1}{-F}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}}\right) \]
      8. neg-mul-199.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\frac{1}{\color{blue}{-1 \cdot F}}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
      9. associate-/r*99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\color{blue}{\frac{\frac{1}{-1}}{F}}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
      10. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \left(-\frac{\color{blue}{-1}}{F}\right) \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
      11. distribute-neg-frac99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \color{blue}{\frac{--1}{F}} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
      12. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\color{blue}{1}}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{-F}\right) \]
      13. times-frac92.1%

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

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

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

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\color{blue}{\frac{-1 \cdot \left(\ell \cdot \pi\right)}{F}}}{F}\right) \]
      2. *-commutative99.4%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\frac{-1 \cdot \color{blue}{\left(\pi \cdot \ell\right)}}{F}}{F}\right) \]
      3. neg-mul-199.4%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\frac{\color{blue}{-\pi \cdot \ell}}{F}}{F}\right) \]
      4. *-commutative99.4%

        \[\leadsto \mathsf{fma}\left(\pi, \ell, \frac{\frac{-\color{blue}{\ell \cdot \pi}}{F}}{F}\right) \]
      5. distribute-rgt-neg-in99.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -5 \cdot 10^{+19} \lor \neg \left(\pi \cdot \ell \leq 0.0001\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\pi, \ell, -\frac{\frac{\pi \cdot \ell}{F}}{F}\right)\\ \end{array} \]

Alternative 4: 98.1% accurate, 0.7× speedup?

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

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

    if -5e19 < (*.f64 (PI.f64) l) < 1.00000000000000005e-4

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.1% accurate, 0.7× speedup?

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

    1. Initial program 58.2%

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

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

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

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

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

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

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

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

    if -5e19 < (*.f64 (PI.f64) l) < 1.00000000000000005e-4

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

Alternative 6: 74.0% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6 \cdot 10^{-38}:\\
\;\;\;\;\pi \cdot \ell\\

\mathbf{elif}\;\ell \leq 5.7 \cdot 10^{-297}:\\
\;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\

\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{-115} \lor \neg \left(\ell \leq 6.2 \cdot 10^{-46}\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -5.99999999999999977e-38 or 5.6999999999999997e-297 < l < 7.20000000000000018e-115 or 6.2000000000000002e-46 < l

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

    if -5.99999999999999977e-38 < l < 5.6999999999999997e-297

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. *-commutative48.9%

        \[\leadsto \frac{-\color{blue}{\ell \cdot \pi}}{{F}^{2}} \]
      5. distribute-rgt-neg-in48.9%

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

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

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

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

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

        \[\leadsto \frac{-\pi}{\color{blue}{\frac{F}{\ell} \cdot F}} \]
      5. distribute-neg-frac57.9%

        \[\leadsto \color{blue}{-\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
      6. associate-/r*57.9%

        \[\leadsto -\color{blue}{\frac{\frac{\pi}{\frac{F}{\ell}}}{F}} \]
      7. un-div-inv57.9%

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

        \[\leadsto -\color{blue}{\frac{1}{F} \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      9. distribute-lft-neg-in57.9%

        \[\leadsto \color{blue}{\left(-\frac{1}{F}\right) \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      10. distribute-neg-frac57.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)} \]
    10. Step-by-step derivation
      1. *-commutative57.9%

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

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

        \[\leadsto \left(\pi \cdot \frac{\ell}{F}\right) \cdot \frac{\color{blue}{1}}{-F} \]
      4. un-div-inv57.9%

        \[\leadsto \color{blue}{\frac{\pi \cdot \frac{\ell}{F}}{-F}} \]
      5. associate-*r/58.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{\ell}{\frac{F}{\pi}}}}{-F} \]
    11. Applied egg-rr57.9%

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

    if 7.20000000000000018e-115 < l < 6.2000000000000002e-46

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. *-commutative99.9%

        \[\leadsto \frac{-\color{blue}{\ell \cdot \pi}}{{F}^{2}} \]
      5. distribute-rgt-neg-in99.9%

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

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

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

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

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

        \[\leadsto \frac{-\pi}{\color{blue}{\frac{F}{\ell} \cdot F}} \]
      5. distribute-neg-frac99.4%

        \[\leadsto \color{blue}{-\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
      6. associate-/r*99.3%

        \[\leadsto -\color{blue}{\frac{\frac{\pi}{\frac{F}{\ell}}}{F}} \]
      7. un-div-inv99.7%

        \[\leadsto -\color{blue}{\frac{\pi}{\frac{F}{\ell}} \cdot \frac{1}{F}} \]
      8. *-commutative99.7%

        \[\leadsto -\color{blue}{\frac{1}{F} \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      9. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{-1}{F}} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      11. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{-1}}{F} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      12. div-inv99.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6 \cdot 10^{-38}:\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{elif}\;\ell \leq 5.7 \cdot 10^{-297}:\\ \;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\ \mathbf{elif}\;\ell \leq 7.2 \cdot 10^{-115} \lor \neg \left(\ell \leq 6.2 \cdot 10^{-46}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)\\ \end{array} \]

Alternative 7: 74.1% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{-37} \lor \neg \left(\ell \leq 4.5 \cdot 10^{-296} \lor \neg \left(\ell \leq 1.2 \cdot 10^{-114}\right) \land \ell \leq 2.1 \cdot 10^{-45}\right):\\
\;\;\;\;\pi \cdot \ell\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.10000000000000001e-37 or 4.5000000000000002e-296 < l < 1.2000000000000001e-114 or 2.09999999999999995e-45 < l

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

    if -1.10000000000000001e-37 < l < 4.5000000000000002e-296 or 1.2000000000000001e-114 < l < 2.09999999999999995e-45

    1. Initial program 92.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\pi \cdot \ell}}{{F}^{2}} \]
      4. *-commutative58.1%

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

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

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

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

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

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

        \[\leadsto \frac{-\pi}{\color{blue}{\frac{F}{\ell} \cdot F}} \]
      5. distribute-neg-frac65.4%

        \[\leadsto \color{blue}{-\frac{\pi}{\frac{F}{\ell} \cdot F}} \]
      6. associate-/r*65.4%

        \[\leadsto -\color{blue}{\frac{\frac{\pi}{\frac{F}{\ell}}}{F}} \]
      7. un-div-inv65.4%

        \[\leadsto -\color{blue}{\frac{\pi}{\frac{F}{\ell}} \cdot \frac{1}{F}} \]
      8. *-commutative65.4%

        \[\leadsto -\color{blue}{\frac{1}{F} \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      9. distribute-lft-neg-in65.4%

        \[\leadsto \color{blue}{\left(-\frac{1}{F}\right) \cdot \frac{\pi}{\frac{F}{\ell}}} \]
      10. distribute-neg-frac65.4%

        \[\leadsto \color{blue}{\frac{-1}{F}} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      11. metadata-eval65.4%

        \[\leadsto \frac{\color{blue}{-1}}{F} \cdot \frac{\pi}{\frac{F}{\ell}} \]
      12. div-inv65.4%

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

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

      \[\leadsto \color{blue}{\frac{-1}{F} \cdot \left(\pi \cdot \frac{\ell}{F}\right)} \]
    10. Step-by-step derivation
      1. *-commutative65.4%

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

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

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

        \[\leadsto \color{blue}{\frac{\pi \cdot \frac{\ell}{F}}{-F}} \]
      5. associate-*r/65.5%

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

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

        \[\leadsto \frac{\color{blue}{\frac{\ell}{\frac{F}{\pi}}}}{-F} \]
    11. Applied egg-rr65.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{-37} \lor \neg \left(\ell \leq 4.5 \cdot 10^{-296} \lor \neg \left(\ell \leq 1.2 \cdot 10^{-114}\right) \land \ell \leq 2.1 \cdot 10^{-45}\right):\\ \;\;\;\;\pi \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\ell}{\frac{F}{\pi}}}{-F}\\ \end{array} \]

Alternative 8: 73.9% 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 74.5%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\ell \cdot \pi} \]
  6. Final simplification78.7%

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

Reproduce

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