-\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(\left(\left({\pi}^{2} \cdot \left(f \cdot f\right)\right) \cdot 0.0078125 + \left(\log \left(\frac{4}{\pi}\right) + \left(\left(\pi \cdot f\right) \cdot -0.125 + \left(\pi \cdot f\right) \cdot 0.125\right)\right)\right) - \left({\pi}^{2} \cdot \left(\left(f \cdot f\right) \cdot 0.0026041666666666665\right) + \left(\log f + {\pi}^{2} \cdot \left(\left(f \cdot \left(f \cdot -0.25\right)\right) \cdot 0.0625\right)\right)\right)\right) \cdot \frac{-4}{\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
(*
(-
(+
(* (* (pow PI 2.0) (* f f)) 0.0078125)
(+ (log (/ 4.0 PI)) (+ (* (* PI f) -0.125) (* (* PI f) 0.125))))
(+
(* (pow PI 2.0) (* (* f f) 0.0026041666666666665))
(+ (log f) (* (pow PI 2.0) (* (* f (* f -0.25)) 0.0625)))))
(/ -4.0 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 ((((pow(((double) M_PI), 2.0) * (f * f)) * 0.0078125) + (log(4.0 / ((double) M_PI)) + (((((double) M_PI) * f) * -0.125) + ((((double) M_PI) * f) * 0.125)))) - ((pow(((double) M_PI), 2.0) * ((f * f) * 0.0026041666666666665)) + (log(f) + (pow(((double) M_PI), 2.0) * ((f * (f * -0.25)) * 0.0625))))) * (-4.0 / ((double) M_PI));
}



Bits error versus f
Results
Initial program 61.5
Simplified61.5
Taylor expanded around 0 2.2
Simplified2.2
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2020352
(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)))))))))