In computation of magnetostatic fields in regions containing current sources, it is classical to write the corresponding magnetostatic problem in terms of the reduced scalar magnetic potential φ. Usually numerical differentiation is used to obtain the magnetic field H from the potential values, which implies loss in accuracy. An alternative is to compute H from φ by an integral formula. In fact, the formula does not give a straightforward solution because of a cancellation in the integral. In this paper, we investigate the mathematical reason why the formula is not suited for numerical purposes. We carry out a careful numerical analysis with illustrations on a test example and propose a way to circumvent this difficulty by using a sort of decomposition method.