Average Error: 61.6 → 0.7
Time: 20.0s
Precision: binary64
Cost: 26176
\[-\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) \]
\[\frac{\log \tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)}{-0.08333333333333333} \cdot \frac{-0.3333333333333333}{\pi} \]
(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
 (*
  (/ (log (tanh (* f (* PI 0.25)))) -0.08333333333333333)
  (/ -0.3333333333333333 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) {
	return (log(tanh((f * (((double) M_PI) * 0.25)))) / -0.08333333333333333) * (-0.3333333333333333 / ((double) M_PI));
}
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 (Math.log(Math.tanh((f * (Math.PI * 0.25)))) / -0.08333333333333333) * (-0.3333333333333333 / Math.PI);
}
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 (math.log(math.tanh((f * (math.pi * 0.25)))) / -0.08333333333333333) * (-0.3333333333333333 / math.pi)
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(log(tanh(Float64(f * Float64(pi * 0.25)))) / -0.08333333333333333) * Float64(-0.3333333333333333 / pi))
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 = (log(tanh((f * (pi * 0.25)))) / -0.08333333333333333) * (-0.3333333333333333 / pi);
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[Log[N[Tanh[N[(f * N[(Pi * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / -0.08333333333333333), $MachinePrecision] * N[(-0.3333333333333333 / Pi), $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)
\frac{\log \tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)}{-0.08333333333333333} \cdot \frac{-0.3333333333333333}{\pi}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 61.6

    \[-\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) \]
  2. Applied egg-rr2.0

    \[\leadsto -\frac{1}{\frac{\pi}{4}} \cdot \log \color{blue}{\left(1 \cdot \frac{2 \cdot \cosh \left(\frac{\pi}{4} \cdot f\right)}{2 \cdot \sinh \left(\frac{\pi}{4} \cdot f\right)}\right)} \]
  3. Applied egg-rr0.7

    \[\leadsto -\color{blue}{\frac{\log \tanh \left(\left(\pi \cdot f\right) \cdot 0.25\right)}{\pi \cdot -0.25}} \]
  4. Applied egg-rr0.8

    \[\leadsto -\frac{\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)\right)}}{\pi \cdot -0.25} \]
  5. Applied egg-rr0.7

    \[\leadsto -\color{blue}{\frac{\log \tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)}{-0.08333333333333333} \cdot \frac{0.3333333333333333}{\pi}} \]
  6. Final simplification0.7

    \[\leadsto \frac{\log \tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)}{-0.08333333333333333} \cdot \frac{-0.3333333333333333}{\pi} \]

Alternatives

Alternative 1
Error0.7
Cost26112
\[\frac{-\log \tanh \left(0.25 \cdot \left(f \cdot \pi\right)\right)}{\pi \cdot -0.25} \]
Alternative 2
Error2.7
Cost26048
\[\frac{4}{\pi} \cdot \left(\log f + \log \left(\pi \cdot 0.25\right)\right) \]
Alternative 3
Error62.9
Cost19648
\[4 \cdot \frac{\log \left(\frac{\frac{4}{\pi}}{f}\right)}{\pi} \]
Alternative 4
Error2.8
Cost19648
\[\log \left(\frac{4}{f \cdot \pi}\right) \cdot \frac{-4}{\pi} \]
Alternative 5
Error2.7
Cost19648
\[\frac{\log \left(\frac{4}{f \cdot \pi}\right) \cdot -4}{\pi} \]

Error

Reproduce

herbie shell --seed 2022297 
(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)))))))))