Average Error: 16.3 → 8.3
Time: 6.7s
Precision: binary64
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)\]
\[\begin{array}{l} \mathbf{if}\;F \leq -2.5900579807970206 \cdot 10^{-184}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F}\\ \mathbf{elif}\;F \leq 2.3653030936545813 \cdot 10^{-148}:\\ \;\;\;\;\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right) \cdot \left(F \cdot F\right)}{\cos \left(\pi \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}\\ \end{array}\]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\begin{array}{l}
\mathbf{if}\;F \leq -2.5900579807970206 \cdot 10^{-184}:\\
\;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F}\\

\mathbf{elif}\;F \leq 2.3653030936545813 \cdot 10^{-148}:\\
\;\;\;\;\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right) \cdot \left(F \cdot F\right)}{\cos \left(\pi \cdot \ell\right)}\\

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

\end{array}
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (if (<= F -2.5900579807970206e-184)
   (- (* PI l) (* (/ 1.0 F) (/ (tan (* (sqrt PI) (* l (sqrt PI)))) F)))
   (if (<= F 2.3653030936545813e-148)
     (- (* PI l) (/ (* (sin (* PI l)) (* F F)) (cos (* PI l))))
     (- (* PI l) (* (/ 1.0 F) (/ (tan (* PI l)) 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 (F <= -2.5900579807970206e-184) {
		tmp = (((double) M_PI) * l) - ((1.0 / F) * (tan(sqrt((double) M_PI) * (l * sqrt((double) M_PI))) / F));
	} else if (F <= 2.3653030936545813e-148) {
		tmp = (((double) M_PI) * l) - ((sin(((double) M_PI) * l) * (F * F)) / cos(((double) M_PI) * l));
	} else {
		tmp = (((double) M_PI) * l) - ((1.0 / F) * (tan(((double) M_PI) * l) / 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 F < -2.59005798079702062e-184

    1. Initial program 8.2

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

      \[\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_binary648.0

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

      \[\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-sqr-sqrt_binary646.8

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

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

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

    if -2.59005798079702062e-184 < F < 2.3653030936545813e-148

    1. Initial program 62.8

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

      \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}}\]
    3. Taylor expanded around inf 19.7

      \[\leadsto \pi \cdot \ell - \color{blue}{\frac{\sin \left(\pi \cdot \ell\right) \cdot {F}^{2}}{\cos \left(\pi \cdot \ell\right)}}\]
    4. Simplified19.7

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

    if 2.3653030936545813e-148 < F

    1. Initial program 4.8

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

      \[\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_binary644.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.5900579807970206 \cdot 10^{-184}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\sqrt{\pi} \cdot \left(\ell \cdot \sqrt{\pi}\right)\right)}{F}\\ \mathbf{elif}\;F \leq 2.3653030936545813 \cdot 10^{-148}:\\ \;\;\;\;\pi \cdot \ell - \frac{\sin \left(\pi \cdot \ell\right) \cdot \left(F \cdot F\right)}{\cos \left(\pi \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;\pi \cdot \ell - \frac{1}{F} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{F}\\ \end{array}\]

Reproduce

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