(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 (+ (+ (* 4.0 (log (pow f (/ 1.0 PI)))) (* 0.0012152777777777778 (* (pow f 4.0) (pow PI 3.0)))) (+ (* (* PI (pow f 2.0)) -0.08333333333333333) (* (/ (log (/ 4.0 PI)) PI) -4.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) {
return ((4.0 * log(pow(f, (1.0 / ((double) M_PI))))) + (0.0012152777777777778 * (pow(f, 4.0) * pow(((double) M_PI), 3.0)))) + (((((double) M_PI) * pow(f, 2.0)) * -0.08333333333333333) + ((log((4.0 / ((double) M_PI))) / ((double) M_PI)) * -4.0));
}
public static double code(double f) {
return -((1.0 / (Math.PI / 4.0)) * Math.log(((Math.exp(((Math.PI / 4.0) * f)) + Math.exp(-((Math.PI / 4.0) * f))) / (Math.exp(((Math.PI / 4.0) * f)) - Math.exp(-((Math.PI / 4.0) * f))))));
}
public static double code(double f) {
return ((4.0 * Math.log(Math.pow(f, (1.0 / Math.PI)))) + (0.0012152777777777778 * (Math.pow(f, 4.0) * Math.pow(Math.PI, 3.0)))) + (((Math.PI * Math.pow(f, 2.0)) * -0.08333333333333333) + ((Math.log((4.0 / Math.PI)) / Math.PI) * -4.0));
}
def code(f): return -((1.0 / (math.pi / 4.0)) * math.log(((math.exp(((math.pi / 4.0) * f)) + math.exp(-((math.pi / 4.0) * f))) / (math.exp(((math.pi / 4.0) * f)) - math.exp(-((math.pi / 4.0) * f))))))
def code(f): return ((4.0 * math.log(math.pow(f, (1.0 / math.pi)))) + (0.0012152777777777778 * (math.pow(f, 4.0) * math.pow(math.pi, 3.0)))) + (((math.pi * math.pow(f, 2.0)) * -0.08333333333333333) + ((math.log((4.0 / math.pi)) / math.pi) * -4.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) return Float64(Float64(Float64(4.0 * log((f ^ Float64(1.0 / pi)))) + Float64(0.0012152777777777778 * Float64((f ^ 4.0) * (pi ^ 3.0)))) + Float64(Float64(Float64(pi * (f ^ 2.0)) * -0.08333333333333333) + Float64(Float64(log(Float64(4.0 / pi)) / pi) * -4.0))) end
function tmp = code(f) tmp = -((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)))))); end
function tmp = code(f) tmp = ((4.0 * log((f ^ (1.0 / pi)))) + (0.0012152777777777778 * ((f ^ 4.0) * (pi ^ 3.0)))) + (((pi * (f ^ 2.0)) * -0.08333333333333333) + ((log((4.0 / pi)) / pi) * -4.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_] := N[(N[(N[(4.0 * N[Log[N[Power[f, N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.0012152777777777778 * N[(N[Power[f, 4.0], $MachinePrecision] * N[Power[Pi, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(Pi * N[Power[f, 2.0], $MachinePrecision]), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] + N[(N[(N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * -4.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)
\left(4 \cdot \log \left({f}^{\left(\frac{1}{\pi}\right)}\right) + 0.0012152777777777778 \cdot \left({f}^{4} \cdot {\pi}^{3}\right)\right) + \left(\left(\pi \cdot {f}^{2}\right) \cdot -0.08333333333333333 + \frac{\log \left(\frac{4}{\pi}\right)}{\pi} \cdot -4\right)



Bits error versus f
Results
Initial program 61.4
Simplified61.4
Taylor expanded in f around 0 2.3
Applied egg-rr2.2
Final simplification2.2
herbie shell --seed 2022153
(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)))))))))