Average Error: 16.4 → 8.6
Time: 8.1s
Precision: binary64
\[\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.328787927371943 \cdot 10^{+155}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F \cdot F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2.504716734864637 \cdot 10^{+128}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{F \cdot \left(\left(1 + 0.041666666666666664 \cdot {\left(\pi \cdot \ell\right)}^{4}\right) - \left(\left(\pi \cdot \ell\right) \cdot \left(\pi \cdot \ell\right)\right) \cdot 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\left(\sqrt[3]{\pi} \cdot \sqrt[3]{\pi}\right) \cdot \left(\ell \cdot \sqrt[3]{\pi}\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 \leq -1.328787927371943 \cdot 10^{+155}:\\
\;\;\;\;\pi \cdot \ell - \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F \cdot F}\\

\mathbf{elif}\;\pi \cdot \ell \leq 2.504716734864637 \cdot 10^{+128}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{F \cdot \left(\left(1 + 0.041666666666666664 \cdot {\left(\pi \cdot \ell\right)}^{4}\right) - \left(\left(\pi \cdot \ell\right) \cdot \left(\pi \cdot \ell\right)\right) \cdot 0.5\right)}\\

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

\end{array}
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (if (<= (* PI l) -1.328787927371943e+155)
   (- (* PI l) (/ (tan (* (sqrt PI) (* l (sqrt PI)))) (* F F)))
   (if (<= (* PI l) 2.504716734864637e+128)
     (-
      (* PI l)
      (*
       (/ 1.0 F)
       (/
        (sin (* PI l))
        (*
         F
         (-
          (+ 1.0 (* 0.041666666666666664 (pow (* PI l) 4.0)))
          (* (* (* PI l) (* PI l)) 0.5))))))
     (-
      (* PI l)
      (* (/ 1.0 F) (/ (tan (* (* (cbrt PI) (cbrt PI)) (* l (cbrt PI)))) F))))))
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;
	if ((((double) M_PI) * l) <= -1.328787927371943e+155) {
		tmp = (((double) M_PI) * l) - (tan(sqrt((double) M_PI) * (l * sqrt((double) M_PI))) / (F * F));
	} else if ((((double) M_PI) * l) <= 2.504716734864637e+128) {
		tmp = (((double) M_PI) * l) - ((1.0 / F) * (sin(((double) M_PI) * l) / (F * ((1.0 + (0.041666666666666664 * pow((((double) M_PI) * l), 4.0))) - (((((double) M_PI) * l) * (((double) M_PI) * l)) * 0.5)))));
	} else {
		tmp = (((double) M_PI) * l) - ((1.0 / F) * (tan((cbrt((double) M_PI) * cbrt((double) M_PI)) * (l * cbrt((double) M_PI))) / F));
	}
	return tmp;
}

Error

Bits error versus F

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 20.4

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

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

      \[\leadsto \pi \cdot \ell - \frac{\tan \left(\color{blue}{\left(\sqrt{\pi} \cdot \sqrt{\pi}\right)} \cdot \ell\right)}{F \cdot F}\]
    5. Applied associate-*l*_binary6420.4

      \[\leadsto \pi \cdot \ell - \frac{\tan \color{blue}{\left(\sqrt{\pi} \cdot \left(\sqrt{\pi} \cdot \ell\right)\right)}}{F \cdot F}\]
    6. Simplified20.4

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

    if -1.328787927371943e155 < (*.f64 PI.f64 l) < 2.50471673486463688e128

    1. Initial program 14.8

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity_binary6414.5

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{1 \cdot \tan \left(\pi \cdot \ell\right)}}{F \cdot F}\]
    5. Applied times-frac_binary649.0

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}}\]
    6. Using strategy rm
    7. Applied tan-quot_binary649.0

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{\cos \left(\pi \cdot \ell\right)}}}{F}\]
    8. Applied associate-/l/_binary649.0

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \color{blue}{\frac{\sin \left(\pi \cdot \ell\right)}{F \cdot \cos \left(\pi \cdot \ell\right)}}\]
    9. Simplified9.0

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{\color{blue}{\cos \left(\pi \cdot \ell\right) \cdot F}}\]
    10. Taylor expanded around 0 3.9

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{\color{blue}{\left(\left(0.041666666666666664 \cdot \left({\pi}^{4} \cdot {\ell}^{4}\right) + 1\right) - 0.5 \cdot \left({\pi}^{2} \cdot {\ell}^{2}\right)\right)} \cdot F}\]
    11. Simplified3.9

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{\color{blue}{\left(\left(1 + 0.041666666666666664 \cdot {\left(\pi \cdot \ell\right)}^{4}\right) - \left(\left(\pi \cdot \ell\right) \cdot \left(\pi \cdot \ell\right)\right) \cdot 0.5\right)} \cdot F}\]

    if 2.50471673486463688e128 < (*.f64 PI.f64 l)

    1. Initial program 20.4

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity_binary6420.4

      \[\leadsto \pi \cdot \ell - \frac{\color{blue}{1 \cdot \tan \left(\pi \cdot \ell\right)}}{F \cdot F}\]
    5. Applied times-frac_binary6420.4

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

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\color{blue}{\left(\left(\sqrt[3]{\pi} \cdot \sqrt[3]{\pi}\right) \cdot \sqrt[3]{\pi}\right)} \cdot \ell\right)}{F}\]
    8. Applied associate-*l*_binary6420.4

      \[\leadsto \pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \color{blue}{\left(\left(\sqrt[3]{\pi} \cdot \sqrt[3]{\pi}\right) \cdot \left(\sqrt[3]{\pi} \cdot \ell\right)\right)}}{F}\]
    9. Simplified20.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\pi \cdot \ell \leq -1.328787927371943 \cdot 10^{+155}:\\ \;\;\;\;\pi \cdot \ell - \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F \cdot F}\\ \mathbf{elif}\;\pi \cdot \ell \leq 2.504716734864637 \cdot 10^{+128}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\sin \left(\pi \cdot \ell\right)}{F \cdot \left(\left(1 + 0.041666666666666664 \cdot {\left(\pi \cdot \ell\right)}^{4}\right) - \left(\left(\pi \cdot \ell\right) \cdot \left(\pi \cdot \ell\right)\right) \cdot 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\left(\sqrt[3]{\pi} \cdot \sqrt[3]{\pi}\right) \cdot \left(\ell \cdot \sqrt[3]{\pi}\right)\right)}{F}\\ \end{array}\]

Reproduce

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