Average Error: 16.4 → 2.3
Time: 17.4s
Precision: binary64
\[\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right) \]
\[\pi \cdot \ell - \frac{1}{F \cdot \left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(\ell \cdot F\right), \mathsf{log1p}\left(\mathsf{expm1}\left(F \cdot \mathsf{fma}\left(0.0021164021164021165, {\pi}^{5} \cdot {\ell}^{5}, 0.022222222222222223 \cdot {\left(\pi \cdot \ell\right)}^{3}\right)\right)\right)\right)\right)} \]
\pi \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\pi \cdot \ell\right)
\pi \cdot \ell - \frac{1}{F \cdot \left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(\ell \cdot F\right), \mathsf{log1p}\left(\mathsf{expm1}\left(F \cdot \mathsf{fma}\left(0.0021164021164021165, {\pi}^{5} \cdot {\ell}^{5}, 0.022222222222222223 \cdot {\left(\pi \cdot \ell\right)}^{3}\right)\right)\right)\right)\right)}
(FPCore (F l)
 :precision binary64
 (- (* PI l) (* (/ 1.0 (* F F)) (tan (* PI l)))))
(FPCore (F l)
 :precision binary64
 (-
  (* PI l)
  (/
   1.0
   (*
    F
    (-
     (/ F (* PI l))
     (fma
      PI
      (* 0.3333333333333333 (* l F))
      (log1p
       (expm1
        (*
         F
         (fma
          0.0021164021164021165
          (* (pow PI 5.0) (pow l 5.0))
          (* 0.022222222222222223 (pow (* 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) {
	return (((double) M_PI) * l) - (1.0 / (F * ((F / (((double) M_PI) * l)) - fma(((double) M_PI), (0.3333333333333333 * (l * F)), log1p(expm1(F * fma(0.0021164021164021165, (pow(((double) M_PI), 5.0) * pow(l, 5.0)), (0.022222222222222223 * pow((((double) M_PI) * l), 3.0)))))))));
}

Error

Bits error versus F

Bits error versus l

Derivation

  1. Initial program 16.4

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

    \[\leadsto \color{blue}{\pi \cdot \ell - \frac{\tan \left(\pi \cdot \ell\right)}{F \cdot F}} \]
  3. Applied clear-num_binary6416.2

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

    \[\leadsto \pi \cdot \ell - \frac{1}{\color{blue}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{F}}}} \]
  5. Applied add-sqr-sqrt_binary6438.2

    \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F}{\frac{\tan \left(\pi \cdot \ell\right)}{\color{blue}{\sqrt{F} \cdot \sqrt{F}}}}} \]
  6. Applied *-un-lft-identity_binary6438.2

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

    \[\leadsto \pi \cdot \ell - \frac{1}{\frac{F}{\color{blue}{\frac{1}{\sqrt{F}} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{\sqrt{F}}}}} \]
  8. Applied add-sqr-sqrt_binary6438.2

    \[\leadsto \pi \cdot \ell - \frac{1}{\frac{\color{blue}{\sqrt{F} \cdot \sqrt{F}}}{\frac{1}{\sqrt{F}} \cdot \frac{\tan \left(\pi \cdot \ell\right)}{\sqrt{F}}}} \]
  9. Applied times-frac_binary6438.2

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

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

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \color{blue}{\frac{F}{\tan \left(\pi \cdot \ell\right)}}} \]
  12. Taylor expanded in l around 0 2.1

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \color{blue}{\left(\frac{F}{\pi \cdot \ell} - \left(0.3333333333333333 \cdot \left(\pi \cdot \left(F \cdot \ell\right)\right) + \left(0.0021164021164021165 \cdot \left({\pi}^{5} \cdot \left({\ell}^{5} \cdot F\right)\right) + 0.022222222222222223 \cdot \left({\pi}^{3} \cdot \left({\ell}^{3} \cdot F\right)\right)\right)\right)\right)}} \]
  13. Simplified2.1

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \color{blue}{\left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(F \cdot \ell\right), F \cdot \left(0.022222222222222223 \cdot \left({\pi}^{3} \cdot {\ell}^{3}\right) + 0.0021164021164021165 \cdot \left({\pi}^{5} \cdot {\ell}^{5}\right)\right)\right)\right)}} \]
  14. Applied log1p-expm1-u_binary642.3

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(F \cdot \ell\right), \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(F \cdot \left(0.022222222222222223 \cdot \left({\pi}^{3} \cdot {\ell}^{3}\right) + 0.0021164021164021165 \cdot \left({\pi}^{5} \cdot {\ell}^{5}\right)\right)\right)\right)}\right)\right)} \]
  15. Simplified2.3

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(F \cdot \ell\right), \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(F \cdot \mathsf{fma}\left(0.0021164021164021165, {\pi}^{5} \cdot {\ell}^{5}, 0.022222222222222223 \cdot {\left(\pi \cdot \ell\right)}^{3}\right)\right)}\right)\right)\right)} \]
  16. Final simplification2.3

    \[\leadsto \pi \cdot \ell - \frac{1}{F \cdot \left(\frac{F}{\pi \cdot \ell} - \mathsf{fma}\left(\pi, 0.3333333333333333 \cdot \left(\ell \cdot F\right), \mathsf{log1p}\left(\mathsf{expm1}\left(F \cdot \mathsf{fma}\left(0.0021164021164021165, {\pi}^{5} \cdot {\ell}^{5}, 0.022222222222222223 \cdot {\left(\pi \cdot \ell\right)}^{3}\right)\right)\right)\right)\right)} \]

Reproduce

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