-\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)
\log \left(\mathsf{expm1}\left(\mathsf{log1p}\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)\right)\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
(expm1
(log1p
(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 (/ 4.0 (* PI f)))))
(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) {
return log(expm1(log1p(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, (4.0 / (((double) M_PI) * f))))), sqrt(1.0 / ((double) M_PI)))))) * (-4.0 / sqrt((double) M_PI));
}



Bits error versus f
Initial program 61.5
Simplified61.5
Taylor expanded in f around 0 2.2
Simplified2.2
Applied add-sqr-sqrt_binary643.0
Applied *-un-lft-identity_binary643.0
Applied times-frac_binary642.5
Applied associate-*r*_binary642.1
Applied add-log-exp_binary642.1
Simplified2.1
Applied expm1-log1p-u_binary642.1
Final simplification2.1
herbie shell --seed 2022088
(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)))))))))