The formula involves Bernoulli numbers or Euler polynomials evaluated in zero. The role of Bernoulli numbers in quantum-mechanical identities such as the Baker–Campbell–Hausdorff formula is emphasized and applications connected to ordering problems as well as to the Ehrenfest theorem are proposed.