Routine for calcuting preceding type