(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 (* PI f) 3.0)
-0.00034722222222222224
(fma
(pow (* PI f) 5.0)
2.066798941798942e-6
(fma (* PI f) 0.08333333333333333 (/ 4.0 (* PI f))))))
-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 (log(fma(pow((((double) M_PI) * f), 3.0), -0.00034722222222222224, fma(pow((((double) M_PI) * f), 5.0), 2.066798941798942e-6, fma((((double) M_PI) * f), 0.08333333333333333, (4.0 / (((double) M_PI) * f)))))) * -4.0) / ((double) M_PI);
}
function code(f) return Float64(-Float64(Float64(1.0 / Float64(pi / 4.0)) * log(Float64(Float64(exp(Float64(Float64(pi / 4.0) * f)) + exp(Float64(-Float64(Float64(pi / 4.0) * f)))) / Float64(exp(Float64(Float64(pi / 4.0) * f)) - exp(Float64(-Float64(Float64(pi / 4.0) * f)))))))) end
function code(f) return Float64(Float64(log(fma((Float64(pi * f) ^ 3.0), -0.00034722222222222224, fma((Float64(pi * f) ^ 5.0), 2.066798941798942e-6, fma(Float64(pi * f), 0.08333333333333333, Float64(4.0 / Float64(pi * f)))))) * -4.0) / pi) end
code[f_] := (-N[(N[(1.0 / N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] + N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] - N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
code[f_] := N[(N[(N[Log[N[(N[Power[N[(Pi * f), $MachinePrecision], 3.0], $MachinePrecision] * -0.00034722222222222224 + N[(N[Power[N[(Pi * f), $MachinePrecision], 5.0], $MachinePrecision] * 2.066798941798942e-6 + N[(N[(Pi * f), $MachinePrecision] * 0.08333333333333333 + N[(4.0 / N[(Pi * f), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -4.0), $MachinePrecision] / Pi), $MachinePrecision]
-\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)
\frac{\log \left(\mathsf{fma}\left({\left(\pi \cdot f\right)}^{3}, -0.00034722222222222224, \mathsf{fma}\left({\left(\pi \cdot f\right)}^{5}, 2.066798941798942 \cdot 10^{-6}, \mathsf{fma}\left(\pi \cdot f, 0.08333333333333333, \frac{4}{\pi \cdot f}\right)\right)\right)\right) \cdot -4}{\pi}



Bits error versus f
Initial program 61.6
Simplified61.6
Taylor expanded in f around 0 2.1
Simplified2.1
Applied egg-rr2.0
Final simplification2.0
herbie shell --seed 2022140
(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)))))))))