Average Error: 59.9 → 2.1
Time: 28.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) \]
\[\begin{array}{l} t_0 := \sqrt[3]{\frac{4}{\pi \cdot f}}\\ \log \left({\left(\mathsf{fma}\left({\left(\pi \cdot f\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left(2.066798941798942 \cdot 10^{-6}, {\pi}^{5} \cdot {f}^{5}, \mathsf{fma}\left(\pi \cdot f, 0.08333333333333333, t_0 \cdot \left(t_0 \cdot t_0\right)\right)\right)\right)\right)}^{\left(\sqrt{\frac{1}{\pi}}\right)}\right) \cdot \frac{-4}{\sqrt{\pi}} \end{array} \]
-\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)
\begin{array}{l}
t_0 := \sqrt[3]{\frac{4}{\pi \cdot f}}\\
\log \left({\left(\mathsf{fma}\left({\left(\pi \cdot f\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left(2.066798941798942 \cdot 10^{-6}, {\pi}^{5} \cdot {f}^{5}, \mathsf{fma}\left(\pi \cdot f, 0.08333333333333333, t_0 \cdot \left(t_0 \cdot t_0\right)\right)\right)\right)\right)}^{\left(\sqrt{\frac{1}{\pi}}\right)}\right) \cdot \frac{-4}{\sqrt{\pi}}
\end{array}
(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
 (let* ((t_0 (cbrt (/ 4.0 (* PI f)))))
   (*
    (log
     (pow
      (fma
       (pow (* PI f) 3.0)
       -0.00034722222222222224
       (fma
        2.066798941798942e-6
        (* (pow PI 5.0) (pow f 5.0))
        (fma (* PI f) 0.08333333333333333 (* t_0 (* t_0 t_0)))))
      (sqrt (/ 1.0 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) {
	double t_0 = cbrt(4.0 / (((double) M_PI) * f));
	return log(pow(fma(pow((((double) M_PI) * f), 3.0), -0.00034722222222222224, fma(2.066798941798942e-6, (pow(((double) M_PI), 5.0) * pow(f, 5.0)), fma((((double) M_PI) * f), 0.08333333333333333, (t_0 * (t_0 * t_0))))), sqrt(1.0 / ((double) M_PI)))) * (-4.0 / sqrt((double) M_PI));
}

Error

Bits error versus f

Derivation

  1. Initial program 59.9

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

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

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

    \[\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.1

    \[\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. Applied add-log-exp_binary642.1

    \[\leadsto \color{blue}{\log \left(e^{\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}} \]
  10. Simplified2.1

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

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

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

Reproduce

herbie shell --seed 2022067 
(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)))))))))