(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 (cbrt (log 4.0))))
(fma
-4.0
(/ (- (fma (* t_0 t_0) t_0 (- (log PI))) (log f)) PI)
(*
-2.0
(fma
(/
(fma
(* PI 0.5)
(fma
0.0625
(* PI 2.0)
(* -2.0 (/ (* (* PI 2.0) 0.005208333333333333) 0.5)))
0.0)
PI)
(* f f)
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 t_0 = cbrt(log(4.0));
return fma(-4.0, ((fma((t_0 * t_0), t_0, -log(((double) M_PI))) - log(f)) / ((double) M_PI)), (-2.0 * fma((fma((((double) M_PI) * 0.5), fma(0.0625, (((double) M_PI) * 2.0), (-2.0 * (((((double) M_PI) * 2.0) * 0.005208333333333333) / 0.5))), 0.0) / ((double) M_PI)), (f * f), 0.0)));
}
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) t_0 = cbrt(log(4.0)) return fma(-4.0, Float64(Float64(fma(Float64(t_0 * t_0), t_0, Float64(-log(pi))) - log(f)) / pi), Float64(-2.0 * fma(Float64(fma(Float64(pi * 0.5), fma(0.0625, Float64(pi * 2.0), Float64(-2.0 * Float64(Float64(Float64(pi * 2.0) * 0.005208333333333333) / 0.5))), 0.0) / pi), Float64(f * f), 0.0))) 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_] := Block[{t$95$0 = N[Power[N[Log[4.0], $MachinePrecision], 1/3], $MachinePrecision]}, N[(-4.0 * N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0 + (-N[Log[Pi], $MachinePrecision])), $MachinePrecision] - N[Log[f], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision] + N[(-2.0 * N[(N[(N[(N[(Pi * 0.5), $MachinePrecision] * N[(0.0625 * N[(Pi * 2.0), $MachinePrecision] + N[(-2.0 * N[(N[(N[(Pi * 2.0), $MachinePrecision] * 0.005208333333333333), $MachinePrecision] / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision] / Pi), $MachinePrecision] * N[(f * f), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision]), $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)
\begin{array}{l}
t_0 := \sqrt[3]{\log 4}\\
\mathsf{fma}\left(-4, \frac{\mathsf{fma}\left(t_0 \cdot t_0, t_0, -\log \pi\right) - \log f}{\pi}, -2 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(\pi \cdot 0.5, \mathsf{fma}\left(0.0625, \pi \cdot 2, -2 \cdot \frac{\left(\pi \cdot 2\right) \cdot 0.005208333333333333}{0.5}\right), 0\right)}{\pi}, f \cdot f, 0\right)\right)
\end{array}
Initial program 61.6
Simplified61.6
Taylor expanded in f around 0 2.2
Simplified2.2
Applied egg-rr2.2
Final simplification2.2
herbie shell --seed 2022209
(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)))))))))