Whenever computer simulations on fluids are performed with periodic (cubic) boundary conditions, one of the most frequently performed numerical operations is the calculation of the distance between a given molecule and the nearest image of a neighbour particle. Often this is accomplished by a computer code.