(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)))) (+ (* (* 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))))) + (((((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)))) + (((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)))) + (((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(4.0 * log((f ^ Float64(1.0 / pi)))) + 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)))) + (((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[(4.0 * N[Log[N[Power[f, N[(1.0 / Pi), $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)
4 \cdot \log \left({f}^{\left(\frac{1}{\pi}\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.6
Simplified61.6
Taylor expanded in f around 0 2.4
Simplified2.4
Taylor expanded in f around 0 2.4
Applied egg-rr2.3
Final simplification2.3
herbie shell --seed 2022159
(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)))))))))