-\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 := \log \left(e^{-0.25}\right)\\
t_1 := \pi \cdot t_0\\
t_2 := \pi \cdot 0.25 - t_1\\
t_3 := {t_2}^{4}\\
t_4 := {t_0}^{4}\\
t_5 := {\pi}^{4} \cdot t_4\\
t_6 := {t_2}^{3}\\
t_7 := {t_0}^{2}\\
t_8 := t_7 \cdot {\pi}^{2}\\
t_9 := {t_0}^{3}\\
t_10 := {\pi}^{3} \cdot t_9\\
t_11 := {t_2}^{2}\\
\log \left(\left(0.16666666666666666 \cdot \frac{{f}^{2} \cdot t_10}{t_2} + \left(0.001953125 \cdot \frac{f \cdot {\pi}^{4}}{t_6} + \left(0.5833333333333334 \cdot \frac{{f}^{2} \cdot \left({\pi}^{5} \cdot {t_0}^{5}\right)}{t_6} + \left(0.125 \cdot \frac{f \cdot \left({\pi}^{3} \cdot t_7\right)}{t_11} + \left(0.5 \cdot \frac{f \cdot t_5}{t_6} + \left(0.0029296875 \cdot \frac{{f}^{2} \cdot \left(t_7 \cdot {\left({\pi}^{\left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)}\right)}^{\left(\sqrt[3]{6}\right)}\right)}{t_3} + \left(0.5 \cdot \frac{f \cdot t_8}{t_2} + \left(0.0026041666666666665 \cdot \frac{{f}^{2} \cdot {\pi}^{3}}{t_2} + \left(0.0005696614583333334 \cdot \frac{{f}^{2} \cdot {\pi}^{5}}{t_6} + \left(0.0009765625 \cdot \frac{{f}^{2} \cdot \left(t_0 \cdot {\pi}^{5}\right)}{t_6} + \left(0.041666666666666664 \cdot \frac{{f}^{2} \cdot \left(t_9 \cdot {\left(e^{\log \left({\pi}^{\left(\sqrt[3]{4} \cdot \sqrt[3]{4}\right)}\right)}\right)}^{\left(\sqrt[3]{4}\right)}\right)}{t_11} + \left(0.25 \cdot \frac{{f}^{2} \cdot \left({\pi}^{6} \cdot {t_0}^{6}\right)}{t_3} + \left(0.0625 \cdot \frac{{f}^{2} \cdot \left({\pi}^{5} \cdot t_4\right)}{t_6} + \left(0.5 \cdot \frac{{f}^{2} \cdot t_5}{t_11} + \left(0.25 \cdot \frac{\pi}{t_2} + \left(2 \cdot \frac{1}{f \cdot t_2} + \left(\frac{t_8}{t_11} + \left(0.03125 \cdot \frac{f \cdot {\pi}^{2}}{t_2} + \left(0.8333333333333334 \cdot \frac{f \cdot t_10}{t_11} + \frac{t_1}{t_2}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) - \left(0.03125 \cdot \frac{f \cdot \left({\pi}^{3} \cdot t_0\right)}{t_11} + \left(0.0625 \cdot \frac{f \cdot \left({\pi}^{4} \cdot t_7\right)}{t_6} + \left(0.013020833333333334 \cdot \frac{f \cdot {\pi}^{3}}{t_11} + \left(0.052083333333333336 \cdot \frac{{f}^{2} \cdot \left(t_9 \cdot {\pi}^{5}\right)}{t_6} + \left(0.0625 \cdot \frac{{\pi}^{2}}{t_11} + \left(0.0026041666666666665 \cdot \frac{{f}^{2} \cdot \left(t_0 \cdot {\pi}^{4}\right)}{t_11} + \left(0.046875 \cdot \frac{{f}^{2} \cdot \left(t_4 \cdot {\pi}^{6}\right)}{t_3} + \left(0.013020833333333334 \cdot \frac{{f}^{2} \cdot \left({\pi}^{5} \cdot t_7\right)}{t_6} + \left(0.001953125 \cdot \frac{{f}^{2} \cdot {\pi}^{4}}{t_11} + 6.103515625 \cdot 10^{-5} \cdot \frac{{f}^{2} \cdot {\pi}^{6}}{t_3}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) \cdot \frac{-4}{\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 (log (exp -0.25)))
(t_1 (* PI t_0))
(t_2 (- (* PI 0.25) t_1))
(t_3 (pow t_2 4.0))
(t_4 (pow t_0 4.0))
(t_5 (* (pow PI 4.0) t_4))
(t_6 (pow t_2 3.0))
(t_7 (pow t_0 2.0))
(t_8 (* t_7 (pow PI 2.0)))
(t_9 (pow t_0 3.0))
(t_10 (* (pow PI 3.0) t_9))
(t_11 (pow t_2 2.0)))
(*
(log
(-
(+
(* 0.16666666666666666 (/ (* (pow f 2.0) t_10) t_2))
(+
(* 0.001953125 (/ (* f (pow PI 4.0)) t_6))
(+
(*
0.5833333333333334
(/ (* (pow f 2.0) (* (pow PI 5.0) (pow t_0 5.0))) t_6))
(+
(* 0.125 (/ (* f (* (pow PI 3.0) t_7)) t_11))
(+
(* 0.5 (/ (* f t_5) t_6))
(+
(*
0.0029296875
(/
(*
(pow f 2.0)
(* t_7 (pow (pow PI (* (cbrt 6.0) (cbrt 6.0))) (cbrt 6.0))))
t_3))
(+
(* 0.5 (/ (* f t_8) t_2))
(+
(* 0.0026041666666666665 (/ (* (pow f 2.0) (pow PI 3.0)) t_2))
(+
(* 0.0005696614583333334 (/ (* (pow f 2.0) (pow PI 5.0)) t_6))
(+
(* 0.0009765625 (/ (* (pow f 2.0) (* t_0 (pow PI 5.0))) t_6))
(+
(*
0.041666666666666664
(/
(*
(pow f 2.0)
(*
t_9
(pow
(exp (log (pow PI (* (cbrt 4.0) (cbrt 4.0)))))
(cbrt 4.0))))
t_11))
(+
(*
0.25
(/ (* (pow f 2.0) (* (pow PI 6.0) (pow t_0 6.0))) t_3))
(+
(* 0.0625 (/ (* (pow f 2.0) (* (pow PI 5.0) t_4)) t_6))
(+
(* 0.5 (/ (* (pow f 2.0) t_5) t_11))
(+
(* 0.25 (/ PI t_2))
(+
(* 2.0 (/ 1.0 (* f t_2)))
(+
(/ t_8 t_11)
(+
(* 0.03125 (/ (* f (pow PI 2.0)) t_2))
(+
(* 0.8333333333333334 (/ (* f t_10) t_11))
(/ t_1 t_2))))))))))))))))))))
(+
(* 0.03125 (/ (* f (* (pow PI 3.0) t_0)) t_11))
(+
(* 0.0625 (/ (* f (* (pow PI 4.0) t_7)) t_6))
(+
(* 0.013020833333333334 (/ (* f (pow PI 3.0)) t_11))
(+
(* 0.052083333333333336 (/ (* (pow f 2.0) (* t_9 (pow PI 5.0))) t_6))
(+
(* 0.0625 (/ (pow PI 2.0) t_11))
(+
(*
0.0026041666666666665
(/ (* (pow f 2.0) (* t_0 (pow PI 4.0))) t_11))
(+
(* 0.046875 (/ (* (pow f 2.0) (* t_4 (pow PI 6.0))) t_3))
(+
(*
0.013020833333333334
(/ (* (pow f 2.0) (* (pow PI 5.0) t_7)) t_6))
(+
(* 0.001953125 (/ (* (pow f 2.0) (pow PI 4.0)) t_11))
(*
6.103515625e-5
(/ (* (pow f 2.0) (pow PI 6.0)) t_3)))))))))))))
(/ -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) {
double t_0 = log(exp(-0.25));
double t_1 = ((double) M_PI) * t_0;
double t_2 = (((double) M_PI) * 0.25) - t_1;
double t_3 = pow(t_2, 4.0);
double t_4 = pow(t_0, 4.0);
double t_5 = pow(((double) M_PI), 4.0) * t_4;
double t_6 = pow(t_2, 3.0);
double t_7 = pow(t_0, 2.0);
double t_8 = t_7 * pow(((double) M_PI), 2.0);
double t_9 = pow(t_0, 3.0);
double t_10 = pow(((double) M_PI), 3.0) * t_9;
double t_11 = pow(t_2, 2.0);
return log(((0.16666666666666666 * ((pow(f, 2.0) * t_10) / t_2)) + ((0.001953125 * ((f * pow(((double) M_PI), 4.0)) / t_6)) + ((0.5833333333333334 * ((pow(f, 2.0) * (pow(((double) M_PI), 5.0) * pow(t_0, 5.0))) / t_6)) + ((0.125 * ((f * (pow(((double) M_PI), 3.0) * t_7)) / t_11)) + ((0.5 * ((f * t_5) / t_6)) + ((0.0029296875 * ((pow(f, 2.0) * (t_7 * pow(pow(((double) M_PI), (cbrt(6.0) * cbrt(6.0))), cbrt(6.0)))) / t_3)) + ((0.5 * ((f * t_8) / t_2)) + ((0.0026041666666666665 * ((pow(f, 2.0) * pow(((double) M_PI), 3.0)) / t_2)) + ((0.0005696614583333334 * ((pow(f, 2.0) * pow(((double) M_PI), 5.0)) / t_6)) + ((0.0009765625 * ((pow(f, 2.0) * (t_0 * pow(((double) M_PI), 5.0))) / t_6)) + ((0.041666666666666664 * ((pow(f, 2.0) * (t_9 * pow(exp(log(pow(((double) M_PI), (cbrt(4.0) * cbrt(4.0))))), cbrt(4.0)))) / t_11)) + ((0.25 * ((pow(f, 2.0) * (pow(((double) M_PI), 6.0) * pow(t_0, 6.0))) / t_3)) + ((0.0625 * ((pow(f, 2.0) * (pow(((double) M_PI), 5.0) * t_4)) / t_6)) + ((0.5 * ((pow(f, 2.0) * t_5) / t_11)) + ((0.25 * (((double) M_PI) / t_2)) + ((2.0 * (1.0 / (f * t_2))) + ((t_8 / t_11) + ((0.03125 * ((f * pow(((double) M_PI), 2.0)) / t_2)) + ((0.8333333333333334 * ((f * t_10) / t_11)) + (t_1 / t_2)))))))))))))))))))) - ((0.03125 * ((f * (pow(((double) M_PI), 3.0) * t_0)) / t_11)) + ((0.0625 * ((f * (pow(((double) M_PI), 4.0) * t_7)) / t_6)) + ((0.013020833333333334 * ((f * pow(((double) M_PI), 3.0)) / t_11)) + ((0.052083333333333336 * ((pow(f, 2.0) * (t_9 * pow(((double) M_PI), 5.0))) / t_6)) + ((0.0625 * (pow(((double) M_PI), 2.0) / t_11)) + ((0.0026041666666666665 * ((pow(f, 2.0) * (t_0 * pow(((double) M_PI), 4.0))) / t_11)) + ((0.046875 * ((pow(f, 2.0) * (t_4 * pow(((double) M_PI), 6.0))) / t_3)) + ((0.013020833333333334 * ((pow(f, 2.0) * (pow(((double) M_PI), 5.0) * t_7)) / t_6)) + ((0.001953125 * ((pow(f, 2.0) * pow(((double) M_PI), 4.0)) / t_11)) + (6.103515625e-5 * ((pow(f, 2.0) * pow(((double) M_PI), 6.0)) / t_3)))))))))))) * (-4.0 / ((double) M_PI));
}



Bits error versus f
Results
Initial program 61.5
Simplified61.5
Taylor expanded in f around 0 2.3
Applied add-cube-cbrt_binary642.3
Applied pow-unpow_binary642.3
Applied add-cube-cbrt_binary642.3
Applied pow-unpow_binary642.3
Applied pow-to-exp_binary642.3
Applied exp-prod_binary642.3
Final simplification2.3
herbie shell --seed 2021215
(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)))))))))