Average Error: 17.0 → 1.4
Time: 25.6s
Precision: binary64
Cost: 45704
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 20:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\pi}}{0.3333333333333333} \cdot \frac{\sqrt[3]{\pi \cdot \pi} \cdot \ell}{3}\\ \end{array} \]
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (if (<= (* PI l) -1e+49)
   (if (!= l 0.0) (/ PI (/ 1.0 l)) (* l PI))
   (if (<= (* PI l) 20.0)
     (- (* PI l) (/ (/ (tan (* PI l)) F) F))
     (* (/ (cbrt PI) 0.3333333333333333) (/ (* (cbrt (* PI PI)) l) 3.0)))))
double code(double F, double l) {
	return (((double) M_PI) * l) - ((1.0 / (F * F)) * tan((((double) M_PI) * l)));
}
double code(double F, double l) {
	double tmp_1;
	if ((((double) M_PI) * l) <= -1e+49) {
		double tmp_2;
		if (l != 0.0) {
			tmp_2 = ((double) M_PI) / (1.0 / l);
		} else {
			tmp_2 = l * ((double) M_PI);
		}
		tmp_1 = tmp_2;
	} else if ((((double) M_PI) * l) <= 20.0) {
		tmp_1 = (((double) M_PI) * l) - ((tan((((double) M_PI) * l)) / F) / F);
	} else {
		tmp_1 = (cbrt(((double) M_PI)) / 0.3333333333333333) * ((cbrt((((double) M_PI) * ((double) M_PI))) * l) / 3.0);
	}
	return tmp_1;
}
public static double code(double F, double l) {
	return (Math.PI * l) - ((1.0 / (F * F)) * Math.tan((Math.PI * l)));
}
public static double code(double F, double l) {
	double tmp_1;
	if ((Math.PI * l) <= -1e+49) {
		double tmp_2;
		if (l != 0.0) {
			tmp_2 = Math.PI / (1.0 / l);
		} else {
			tmp_2 = l * Math.PI;
		}
		tmp_1 = tmp_2;
	} else if ((Math.PI * l) <= 20.0) {
		tmp_1 = (Math.PI * l) - ((Math.tan((Math.PI * l)) / F) / F);
	} else {
		tmp_1 = (Math.cbrt(Math.PI) / 0.3333333333333333) * ((Math.cbrt((Math.PI * Math.PI)) * l) / 3.0);
	}
	return tmp_1;
}
function code(F, l)
	return Float64(Float64(pi * l) - Float64(Float64(1.0 / Float64(F * F)) * tan(Float64(pi * l))))
end
function code(F, l)
	tmp_1 = 0.0
	if (Float64(pi * l) <= -1e+49)
		tmp_2 = 0.0
		if (l != 0.0)
			tmp_2 = Float64(pi / Float64(1.0 / l));
		else
			tmp_2 = Float64(l * pi);
		end
		tmp_1 = tmp_2;
	elseif (Float64(pi * l) <= 20.0)
		tmp_1 = Float64(Float64(pi * l) - Float64(Float64(tan(Float64(pi * l)) / F) / F));
	else
		tmp_1 = Float64(Float64(cbrt(pi) / 0.3333333333333333) * Float64(Float64(cbrt(Float64(pi * pi)) * l) / 3.0));
	end
	return tmp_1
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]
code[F_, l_] := If[LessEqual[N[(Pi * l), $MachinePrecision], -1e+49], If[Unequal[l, 0.0], N[(Pi / N[(1.0 / l), $MachinePrecision]), $MachinePrecision], N[(l * Pi), $MachinePrecision]], If[LessEqual[N[(Pi * l), $MachinePrecision], 20.0], N[(N[(Pi * l), $MachinePrecision] - N[(N[(N[Tan[N[(Pi * l), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[Pi, 1/3], $MachinePrecision] / 0.3333333333333333), $MachinePrecision] * N[(N[(N[Power[N[(Pi * Pi), $MachinePrecision], 1/3], $MachinePrecision] * l), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]]]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;\ell \ne 0:\\
\;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\

\mathbf{else}:\\
\;\;\;\;\ell \cdot \pi\\


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{\pi}}{0.3333333333333333} \cdot \frac{\sqrt[3]{\pi \cdot \pi} \cdot \ell}{3}\\


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < -9.99999999999999946e48

    1. Initial program 24.1

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Simplified24.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\pi, \ell, \frac{\tan \left(\pi \cdot \ell\right)}{-F \cdot F}\right)} \]
      Proof
    3. Taylor expanded in l around inf 0.2

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    4. Applied egg-rr0.3

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ } \end{array}} \]

    if -9.99999999999999946e48 < (*.f64 (PI.f64) l) < 20

    1. Initial program 10.1

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Applied egg-rr2.0

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

    if 20 < (*.f64 (PI.f64) l)

    1. Initial program 23.8

      \[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
    2. Simplified23.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\pi, \ell, \frac{\tan \left(\pi \cdot \ell\right)}{-F \cdot F}\right)} \]
      Proof
    3. Taylor expanded in l around inf 1.3

      \[\leadsto \color{blue}{\ell \cdot \pi} \]
    4. Applied egg-rr1.3

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\pi}}{0.3333333333333333} \cdot \frac{\sqrt[3]{\pi \cdot \pi} \cdot \ell}{3}} \]
  3. Recombined 3 regimes into one program.

Alternatives

Alternative 1
Error5.4
Cost32968
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 0.5:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{27} \cdot \frac{\ell}{0.037037037037037035}\\ \end{array} \]
Alternative 2
Error1.5
Cost32968
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 0.5:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{27} \cdot \frac{\ell}{0.037037037037037035}\\ \end{array} \]
Alternative 3
Error12.9
Cost20104
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 0.5:\\ \;\;\;\;\left(\pi + \frac{-1}{F \cdot F}\right) \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{27} \cdot \frac{\ell}{0.037037037037037035}\\ \end{array} \]
Alternative 4
Error12.8
Cost20104
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 0.5:\\ \;\;\;\;\pi \cdot \ell - \frac{\ell}{F \cdot F}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{27} \cdot \frac{\ell}{0.037037037037037035}\\ \end{array} \]
Alternative 5
Error12.2
Cost20104
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1 \cdot 10^{+49}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\ell \ne 0:\\ \;\;\;\;\frac{\pi}{\frac{1}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \pi\\ \end{array}\\ \mathbf{elif}\;\pi \cdot \ell \leq 0.5:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\ell}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\frac{\pi}{27} \cdot \frac{\ell}{0.037037037037037035}\\ \end{array} \]
Alternative 6
Error13.2
Cost6528
\[\ell \cdot \pi \]
Alternative 7
Error61.2
Cost384
\[-\frac{\ell}{F \cdot F} \]

Error

Reproduce

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