Average Error: 16.5 → 8.9
Time: 32.5s
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 -8.659932407972988 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \mathbf{elif}\;\pi \cdot \ell \le 1.3394936946479616 \cdot 10^{-06}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{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 -8.659932407972988 \cdot 10^{+22}:\\
\;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\

\mathbf{elif}\;\pi \cdot \ell \le 1.3394936946479616 \cdot 10^{-06}:\\
\;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{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 r863474 = atan2(1.0, 0.0);
        double r863475 = l;
        double r863476 = r863474 * r863475;
        double r863477 = 1.0;
        double r863478 = F;
        double r863479 = r863478 * r863478;
        double r863480 = r863477 / r863479;
        double r863481 = tan(r863476);
        double r863482 = r863480 * r863481;
        double r863483 = r863476 - r863482;
        return r863483;
}

double f(double F, double l) {
        double r863484 = atan2(1.0, 0.0);
        double r863485 = l;
        double r863486 = r863484 * r863485;
        double r863487 = -8.659932407972988e+22;
        bool r863488 = r863486 <= r863487;
        double r863489 = tan(r863486);
        double r863490 = F;
        double r863491 = r863489 / r863490;
        double r863492 = /* ERROR: no posit support in C */;
        double r863493 = /* ERROR: no posit support in C */;
        double r863494 = r863493 / r863490;
        double r863495 = r863486 - r863494;
        double r863496 = 1.3394936946479616e-06;
        bool r863497 = r863486 <= r863496;
        double r863498 = r863491 / r863490;
        double r863499 = r863486 - r863498;
        double r863500 = r863497 ? r863499 : r863495;
        double r863501 = r863488 ? r863495 : r863500;
        return r863501;
}

Error

Bits error versus F

Bits error versus l

Derivation

  1. Split input into 2 regimes
  2. if (* PI l) < -8.659932407972988e+22 or 1.3394936946479616e-06 < (* PI l)

    1. Initial program 23.5

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}}\]
    3. Using strategy rm
    4. Applied associate-/r*23.5

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

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

    if -8.659932407972988e+22 < (* PI l) < 1.3394936946479616e-06

    1. Initial program 9.1

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}}\]
    3. Using strategy rm
    4. Applied associate-/r*0.9

      \[\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 simplification8.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \le -8.659932407972988 \cdot 10^{+22}:\\ \;\;\;\;\pi \cdot \ell - \frac{\left(\left(\frac{\tan \left(\pi \cdot \ell\right)}{F}\right)\right)}{F}\\ \mathbf{elif}\;\pi \cdot \ell \le 1.3394936946479616 \cdot 10^{-06}:\\ \;\;\;\;\pi \cdot \ell - \frac{\frac{\tan \left(\pi \cdot \ell\right)}{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 2019158 +o rules:numerics
(FPCore (F l)
  :name "VandenBroeck and Keller, Equation (6)"
  (- (* PI l) (* (/ 1 (* F F)) (tan (* PI l)))))