\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\makeatletter

\begin{document}

\pgfmathparse{pgfplotsbarwidthgeneric}\pgfmathresult\\
\pgfmathparse{-0.5*(4*pgfplotsbarwidthgeneric+ (4-1)*(2pt)) + (.5+3)*pgfplotsbarwidthgeneric+ 3*(2pt)}\pgfmathresult\\

\end{document}