(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 (* (/ PI 4.0) f))) (- (/ (log (/ (* 2.0 (cosh t_0)) (* 2.0 (sinh t_0)))) (/ 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) {
double t_0 = (((double) M_PI) / 4.0) * f;
return -(log(((2.0 * cosh(t_0)) / (2.0 * sinh(t_0)))) / (((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) {
double t_0 = (Math.PI / 4.0) * f;
return -(Math.log(((2.0 * Math.cosh(t_0)) / (2.0 * Math.sinh(t_0)))) / (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): t_0 = (math.pi / 4.0) * f return -(math.log(((2.0 * math.cosh(t_0)) / (2.0 * math.sinh(t_0)))) / (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) t_0 = Float64(Float64(pi / 4.0) * f) return Float64(-Float64(log(Float64(Float64(2.0 * cosh(t_0)) / Float64(2.0 * sinh(t_0)))) / Float64(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) t_0 = (pi / 4.0) * f; tmp = -(log(((2.0 * cosh(t_0)) / (2.0 * sinh(t_0)))) / (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_] := Block[{t$95$0 = N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]}, (-N[(N[Log[N[(N[(2.0 * N[Cosh[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[Sinh[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(Pi / 4.0), $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 := \frac{\pi}{4} \cdot f\\
-\frac{\log \left(\frac{2 \cdot \cosh t_0}{2 \cdot \sinh t_0}\right)}{\frac{\pi}{4}}
\end{array}
Results
Initial program 61.5
Applied egg-rr2.0
Final simplification2.0
herbie shell --seed 2022203
(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)))))))))