Average Error: 16.5 → 9.0
Time: 34.0s
Precision: 64
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
\[\begin{array}{l} \mathbf{if}\;\pi \cdot \ell \le -6.235904701205012 \cdot 10^{+37}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \mathbf{elif}\;\pi \cdot \ell \le 64054.58046184225:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{\sqrt[3]{F} \cdot \sqrt[3]{F}}}{\sqrt[3]{F}}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \end{array}\]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\begin{array}{l}
\mathbf{if}\;\pi \cdot \ell \le -6.235904701205012 \cdot 10^{+37}:\\
\;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\

\mathbf{elif}\;\pi \cdot \ell \le 64054.58046184225:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{\sqrt[3]{F} \cdot \sqrt[3]{F}}}{\sqrt[3]{F}}}{F}\\

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

\end{array}
double f(double F, double l) {
        double r658368 = atan2(1.0, 0.0);
        double r658369 = l;
        double r658370 = r658368 * r658369;
        double r658371 = 1.0;
        double r658372 = F;
        double r658373 = r658372 * r658372;
        double r658374 = r658371 / r658373;
        double r658375 = tan(r658370);
        double r658376 = r658374 * r658375;
        double r658377 = r658370 - r658376;
        return r658377;
}

double f(double F, double l) {
        double r658378 = atan2(1.0, 0.0);
        double r658379 = l;
        double r658380 = r658378 * r658379;
        double r658381 = -6.235904701205012e+37;
        bool r658382 = r658380 <= r658381;
        double r658383 = tan(r658380);
        double r658384 = F;
        double r658385 = r658383 / r658384;
        double r658386 = /* ERROR: no posit support in C */;
        double r658387 = /* ERROR: no posit support in C */;
        double r658388 = r658387 / r658384;
        double r658389 = r658380 - r658388;
        double r658390 = 64054.58046184225;
        bool r658391 = r658380 <= r658390;
        double r658392 = cbrt(r658384);
        double r658393 = r658392 * r658392;
        double r658394 = r658383 / r658393;
        double r658395 = r658394 / r658392;
        double r658396 = r658395 / r658384;
        double r658397 = r658380 - r658396;
        double r658398 = r658391 ? r658397 : r658389;
        double r658399 = r658382 ? r658389 : r658398;
        return r658399;
}

Error

Bits error versus F

Bits error versus l

Derivation

  1. Split input into 2 regimes
  2. if (* PI l) < -6.235904701205012e+37 or 64054.58046184225 < (* PI l)

    1. Initial program 23.4

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}}\]
    3. Using strategy rm
    4. Applied insert-posit1615.8

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

    if -6.235904701205012e+37 < (* PI l) < 64054.58046184225

    1. Initial program 9.8

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{F}}{F}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt2.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \le -6.235904701205012 \cdot 10^{+37}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \mathbf{elif}\;\pi \cdot \ell \le 64054.58046184225:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\frac{\tan \left(\pi \cdot \ell\right)}{\sqrt[3]{F} \cdot \sqrt[3]{F}}}{\sqrt[3]{F}}}{F}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \end{array}\]

Reproduce

herbie shell --seed 2019146 +o rules:numerics
(FPCore (F l)
  :name "VandenBroeck and Keller, Equation (6)"
  (- (* PI l) (* (/ 1 (* F F)) (tan (* PI l)))))