-\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}
\mathbf{if}\;\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}} \leq \infty:\\
\;\;\;\;\frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot f\right)} + {\left(e^{-0.25}\right)}^{\left(\pi \cdot f\right)}}{\left(\pi \cdot f\right) \cdot 0.5}\right) \cdot -4}{\pi}\\
\mathbf{else}:\\
\;\;\;\;0\\
\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
(if (<=
(/
(+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f))))
(- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))
INFINITY)
(/
(*
(log
(/
(+ (exp (* 0.25 (* PI f))) (pow (exp -0.25) (* PI f)))
(* (* PI f) 0.5)))
-4.0)
PI)
0.0))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 tmp;
if (((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) INFINITY)) {
tmp = (log((exp(0.25 * (((double) M_PI) * f)) + pow(exp(-0.25), (((double) M_PI) * f))) / ((((double) M_PI) * f) * 0.5)) * -4.0) / ((double) M_PI);
} else {
tmp = 0.0;
}
return tmp;
}



Bits error versus f
Results
if (/.f64 (+.f64 (exp.f64 (*.f64 (/.f64 PI.f64 4) f)) (exp.f64 (neg.f64 (*.f64 (/.f64 PI.f64 4) f)))) (-.f64 (exp.f64 (*.f64 (/.f64 PI.f64 4) f)) (exp.f64 (neg.f64 (*.f64 (/.f64 PI.f64 4) f))))) < +inf.0Initial program 61.5
Simplified61.5
Taylor expanded around 0 1.5
Simplified1.5
rmApplied associate-*r/_binary641.4
Simplified1.4
Taylor expanded around 0 1.4
if +inf.0 < (/.f64 (+.f64 (exp.f64 (*.f64 (/.f64 PI.f64 4) f)) (exp.f64 (neg.f64 (*.f64 (/.f64 PI.f64 4) f)))) (-.f64 (exp.f64 (*.f64 (/.f64 PI.f64 4) f)) (exp.f64 (neg.f64 (*.f64 (/.f64 PI.f64 4) f))))) Initial program 0
Final simplification1.4
herbie shell --seed 2021126
(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)))))))))