Average Error: 61.4 → 2.2
Time: 15.5s
Precision: binary64
\[-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right) \]
\[\left(\log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \frac{-4}{\sqrt{\pi}} \]
-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)
\left(\log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \frac{-4}{\sqrt{\pi}}
(FPCore (f)
 :precision binary64
 (-
  (*
   (/ 1.0 (/ PI 4.0))
   (log
    (/
     (+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f))))
     (- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))
(FPCore (f)
 :precision binary64
 (*
  (*
   (log
    (fma
     (pow (* f PI) 3.0)
     -0.00034722222222222224
     (fma
      (* (pow f 5.0) (pow PI 5.0))
      2.066798941798942e-6
      (fma (* f PI) 0.08333333333333333 (/ 4.0 (* f PI))))))
   (/ 1.0 (sqrt PI)))
  (/ -4.0 (sqrt PI))))
double code(double f) {
	return -((1.0 / (((double) M_PI) / 4.0)) * log((exp((((double) M_PI) / 4.0) * f) + exp(-((((double) M_PI) / 4.0) * f))) / (exp((((double) M_PI) / 4.0) * f) - exp(-((((double) M_PI) / 4.0) * f)))));
}
double code(double f) {
	return (log(fma(pow((f * ((double) M_PI)), 3.0), -0.00034722222222222224, fma((pow(f, 5.0) * pow(((double) M_PI), 5.0)), 2.066798941798942e-6, fma((f * ((double) M_PI)), 0.08333333333333333, (4.0 / (f * ((double) M_PI))))))) * (1.0 / sqrt((double) M_PI))) * (-4.0 / sqrt((double) M_PI));
}

Error

Bits error versus f

Derivation

  1. Initial program 61.4

    \[-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right) \]
  2. Simplified61.4

    \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{\pi}{4} \cdot f} + {\left(e^{-0.25}\right)}^{\left(\pi \cdot f\right)}}{e^{\frac{\pi}{4} \cdot f} - {\left(e^{-0.25}\right)}^{\left(\pi \cdot f\right)}}\right) \cdot \frac{-4}{\pi}} \]
  3. Taylor expanded in f around 0 2.2

    \[\leadsto \log \color{blue}{\left(\left(2.066798941798942 \cdot 10^{-6} \cdot \left({f}^{5} \cdot {\pi}^{5}\right) + \left(4 \cdot \frac{1}{f \cdot \pi} + 0.08333333333333333 \cdot \left(f \cdot \pi\right)\right)\right) - 0.00034722222222222224 \cdot \left({f}^{3} \cdot {\pi}^{3}\right)\right)} \cdot \frac{-4}{\pi} \]
  4. Simplified2.2

    \[\leadsto \log \color{blue}{\left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right)} \cdot \frac{-4}{\pi} \]
  5. Applied add-sqr-sqrt_binary643.1

    \[\leadsto \log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{-4}{\color{blue}{\sqrt{\pi} \cdot \sqrt{\pi}}} \]
  6. Applied *-un-lft-identity_binary643.1

    \[\leadsto \log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{\color{blue}{1 \cdot -4}}{\sqrt{\pi} \cdot \sqrt{\pi}} \]
  7. Applied times-frac_binary642.5

    \[\leadsto \log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \color{blue}{\left(\frac{1}{\sqrt{\pi}} \cdot \frac{-4}{\sqrt{\pi}}\right)} \]
  8. Applied associate-*r*_binary642.2

    \[\leadsto \color{blue}{\left(\log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \frac{-4}{\sqrt{\pi}}} \]
  9. Final simplification2.2

    \[\leadsto \left(\log \left(\mathsf{fma}\left({\left(f \cdot \pi\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({f}^{5} \cdot {\pi}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(f \cdot \pi, 0.08333333333333333, \frac{4}{f \cdot \pi}\right)\right)\right)\right) \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \frac{-4}{\sqrt{\pi}} \]

Reproduce

herbie shell --seed 2022004 
(FPCore (f)
  :name "VandenBroeck and Keller, Equation (20)"
  :precision binary64
  (- (* (/ 1.0 (/ PI 4.0)) (log (/ (+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))) (- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))